Ugandan opposition leader Kizza Besigye has been in High Court as his lawyers cross-examine a woman accusing him of rape in 1997 and 1998, which he denies.
Dr Besigye was once President Museveni's personal physician
After his release on bail this week, Dr Besigye said the charges against him, which also include treason and terrorism, were politically motivated.
He was arrested after returning from exile to contest February's polls.
Meanwhile, President Yoweri Museveni is campaigning in Dr Besigye's home district in south western Uganda.
During the hearing, Joanita Kyakuwa alleged she was twice raped by Dr Besigye, in 1997 and 1998.
She said that she met President Museveni in 2001 and reported the rape to him in the presence of a policewoman.
Since then Ms Kyakuwa claimed she had been given security, accommodation and facilitation by the state.
The BBC's Will Ross in Uganda says Dr Besigye's attempt to defeat Mr Museveni - once his close ally - in next month's presidential election is not being helped by his court appearances.
The rape case will continue on Friday when Dr Besigye's treason trial is also due to begin.
On Tuesday, Dr Besigye joined his four presidential rivals on the campaign trail addressing some 10,000 of his supporters in Kayunga district north-east of the capital, Kampala.
President Museveni has been in power since 1986
Dr Besigye criticised President Museveni over democracy and rights and said it was time for change in Uganda.
"This election is about democracy... this election is about a referendum on President Museveni. After we win, we shall invite our tormentors to come back to the table and see how democracy functions," he said.
While at his rally, President Museveni described Dr Besigye as a coward for leaving the army and said he must prove his innocence.
The president is under fierce international criticism for being reluctant to leave power and for the handling of his main political rival, but he still has considerable support, our correspondent says.
"I like Museveni so much because of bringing peace in Uganda," a woman shopkeeper in Kayunga said, unmoved by Dr Besigye's campaign message.
"I want to stay with Museveni," she said.
On Wednesday, Mr Museveni travelled to Rukungiri District, where our correspondent says he will have to campaign hard as it is the home area of Dr Besigye.
Dr Besigye is viewed as the first credible challenger to Mr Museveni, who has been in power for 19 years.
These will be the first multi-party elections since Mr Museveni took power.
The only woman in the race is the Uganda Peoples Congress party candidate, Miria Obote, wife to the late president Milton Obote.
UPC spokesman Joseph Ochieno told the BBC's Focus on Africa that their campaign was going very well and she had been overwhelmed by the reception she had received across Uganda.
"The Kizza Besigye saga has been rather unfortunate in terms of coverage but we are pleased he has been released. He should not have been imprisoned in the first place."