Anwar called the three judges of the Court of Appeal "spineless" and "under the thumb of the exective", before they demanded his lawyer restrain him and then walked out of the courtroom.
Anwar shouted after them: "Judges are running away, shame on you."
The popular leader has already spent four years behind bars on what supporters say are politically motivated charges and was seeking bail while awaiting the outcome of an appeal against the sodomy conviction.
The Court of Appeal had been considering the bail plea since arguments ended on 23 July after a hearing that began last April.
Appeals for bail
"Judges are running away, shame on you. For nine months this application has been
with you - do you
have a problem of amnesia"
"For nine months this application has been with you - do you
have a problem of amnesia?" Anwar asked.
The United States and Amnesty International regard Anwar as a political prisoner and Human Rights Watch on Tuesday urged the court to grant him bail.
"Anwar has already been in jail for more than five years," said Brad Adams, executive director of Human Rights Watch's Asia division.
"He has been beaten and denied medical care, he was forced to sit through a trial that made a mockery of justice."
"Releasing Anwar would end the injustice he's suffered and signal a renewed spirit of independence for Malaysia's judiciary," Adams added.
After the judges walked out, Anwar told the courtroom audience, including diplomats from the US, Britain and Canada, that Abd Allah's pledges to combat corruption and foster transparency in Malaysia were "hypocrisy".
"Abd Allah (Ahmad Badawi) should stop this charade. Abd Allah should ensure there is a separation of powers. Abd Allah should free himself from Mahathir's grip," he said.
"Abd Allah should stop this charade. Abd Allah should ensure there is a separation of powers. Abd Allah should free himself from Mahathir's grip. It is hypocrisy when he talks about corruption and transparency"
"It is hypocrisy when he talks about corruption and transparency. You expect me to be quiet when there is deceit?
"After nine months of deliberation, it is sickening that they announced this decision. My sympathy is for my family and (wife) Azizah but I know they will be strong."
His supporters in court also stood up and shouted, repeating what Anwar said, while outside the court around 100 demonstrators carrying placards chanted Anwar's battlecry of "reformasi" (reform).
One of Anwar's lawyers, Christopher Fernando, said his client's outburst was "justified".
"Denial of bail is a travesty of justice. Also the judge declined to give reasons for the denial. It is unprecendented. Anwar wants to know the reasons why bail is denied.
"We will now go to the Federal Court, with both the bail (application) and the sodomy (appeal)," Fernando said.
Former Malaysian prime minister Mahathir Muhammad sacked the charismatic and popular Anwar in 1998 and he was later sentenced to 15 years in prison for corruption and sodomy.
Anwar says the charges were trumped up to prevent him from making a challenge for the premiership.
Some supporters were hoping that Anwar might be released following Mahathir's retirement last October.
Anwar wants to travel abroad for treatment for a slipped disc, which he says was caused by a police assault when he was first arrested.
Anwar's younger brother Rosli Ibrahim said: "Anwar is in great pain. The bail would have allowed him to get treatment. This decision is inhumane but Anwar will continue his fight. He will not give up his struggle, he is innocent."