A Ugandan academic detained for likening President Yoweri Museveni to a person's bottom fears authorities are trying to have her declared insane to lock her up in a psychiatric facility.

Stella Nyanzi, a research fellow at Uganda's Makerere University, was charged with "cyber-harassment" for referring to Museveni as "a pair of buttocks" in one of her Facebook posts, according to court documents.

Nyanzi's lawyer, Nicholas Opiyo, said on Thursday she told him two men presenting themsleves as doctors tried to trick her into taking a psychiatric test a day earlier. The two were from a government mental hospital, he claimed.

"They [the government] do not want to go to trial," Opiyo said. "They just want to delegitimise Stella, characterise her as a fool, a mad person ... and confine her to a mental hospital."

READ MORE: Academic Stella Nyanzi charged with 'cyber-harassment'

At her court hearing on Monday, Nyanzi had objected to prosecutors' request for an evaluation of her mental health.

Frank Baine, a spokesman for the Uganda Prisons department, denied the two men who visited Nyanzi were mental health specialists. The medical exam was "a routine medical exam that every new inmate undergoes to avoid risks of spreading infection", he said.

In Uganda mental exams are usually reserved for suspects accused of crimes such as statutory rape.

Nyanzi, a single mother of three, remains in custody pending a bail hearing. She has denied the charges but said she often writes metaphorically "to speak truth to power".

She is popular on Facebook for her relentless criticism of Museveni, 72, who has ruled Uganda since 1986.

New York-based Human Rights Watch said Nyanzi's arrest and prosecution was an "indicator that those who express critical views of the Ugandan government, especially the first family, can face its wrath".

Museveni secured his latest term in office last year in a poll that independent monitors said lacked credibility and transparency.

Some Ugandan politicians have been recently saying they would back a proposal to remove the age limit from the country's constitution, the last obstacle to a possible life presidency for Museveni.