Anwar, a former deputy prime minister, protested the order when he appeared in a district court on Tuesday.
He has repeatedly rejected the allegations, which he says are part of a plot by his political opponents.
"I am concerned over the issue of fair trial," he said at the hearing to decide if the case should be transferred.
"I find it difficult to understand why the AG is so desperate, fighting tooth and nail, to go to the High Court."
He said the order has "raised a lot of suspicion" that the government would pick a biased judge in the high court.
Yusof Zainal Abiden, the prosecutor in Anwar's trial, urged the district court to "follow the procedure" and transfer the case.
But defence lawyers have maintained that Abdul Gani should stay out of Anwar's case because of his alleged involvement in a previous sodomy charge against Anwar in 1998, when he was sacked from the government and subsequently jailed.
"The AG should play no part, and he should not be deciding this," Sulaiman Abdullah, Anwar's lawyer, told the district court, adding that the order was void because it was "signed by somebody who has been disqualified".
Anwar's sodomy conviction was overturned in 2004, but a conviction on a separate corruption charge remains.
Malaysian law criminalises sodomy, even if the act is between consenting adults.
Anwar's trial comes amid escalating racial and political tensions in Malaysia, with the government's popularity rating at an all-time low following the loss of its two-third majority in parliament in the March general elections.
The opposition alliance has repeatedly said it plans to remove the present leadership by orchestrating the defection of more than 30 government MPs.