It also ordered President Jacob Zuma to pay the costs of his latest court challenge against the inquiry into influence peddling. Judge President Mlambo said Zuma's conduct "amounts to clear abuse of the judicial process".
South Africa's High Court ruled on Wednesday that President Jacob Zuma must set up a judicial inquiry into state influence-peddling within 30 days, the latest in a series of judicial blows to his scandal-tinged administration.
Upholding a recommendation by South Africa's corruption-fighting Public Protector, High Court Judge President Dunstan Mlambo said an application by Zuma challenging the inquiry was "ill-advised and reckless" and an abuse of the judicial process.
The ruling comes days after the same court dealt a stinging rebuke to Zuma by ruling that his appointment of a state prosecutor to decide whether to reinstate corruption charges against him was not valid and should be set aside immediately.
Zuma challenged presidential precedent
Zuma had challenged the right of the Public Protector to call for a judicial inquiry and the appointment by the chief justice of a judge to head it, saying it was the president's prerogative whether to set up such an inquiry.
It was not immediately clear if Zuma would appeal against Wednesday's ruling and his spokesman was not immediately available to comment.
On Friday, Zuma said he will appeal against the High Court's ruling that his appointment of a state prosecutor was not valid and that Deputy President Cyril Ramaphosa should instead appoint a new public prosecutor within 60 days.
Ramaphosa, the main rival for the ANC leadership to former African Union chairwoman Nkosazana Dlamini-Zuma, who is Zuma's favoured candidate and ex-wife, has recently stepped up criticism of Zuma's scandal-plagued government.
Not Zuma's first corruption allegation
The 75-year-old president has faced and denied numerous corruption allegations since taking office in 2009 and has survived several votes of no-confidence in parliament.
In October, the Supreme Court of Appeal upheld an earlier High Court decision reinstating nearly 800 corruption charges relating to an arms deal that were filed against Zuma but shelved before he ran for president in 2009.
The revival of the charges could increase pressure on Zuma to step down before his term ends in 2019.
Several judicial setbacks have undermined Zuma's authority and some analysts say it could diminish his influence over who succeeds him when the ruling African National Congress (ANC) chooses a new leader this month.
Political instability, including questions over who will replace Zuma has been cited by credit rating agencies as a major factor behind their decision to cut South Africa to "junk".
Africa's most industrialised economy has grown lethargically over the last six years and the jobless rate stands near record levels. Analysts say the political crisis is making it hard to reform the economy, improve social services and fight crime.
Opposition welcomes ruling
Opposition leader Mmusi Maimane, who was at the court, welcomed the ruling.
"The judgment lays out a timeline ... we hope to get to the bottom of this," Maimane said, adding that his party would oppose any appeal in the case should Zuma launch one.
Court says Zuma's conduct is 'objectionable'
Ordering Zuma to pay the costs of the latest court challenge, Judge President Mlambo said the South African leader's conduct was "clearly objectionable ... and amounts to clear abuse of the judicial process".
A judicial commission was best suited to investigate the allegations against Zuma, Mlambo said, adding: "The allegations ... detailed in the report are extremely serious."
The court ordered that once the inquiry is set up, it should complete its task and present its report to Zuma within 180 days. The president would then have to inform parliament within 14 days of what action he planned to take based on the inquiry's findings, the court said.
In a statement, the ANC - some of whose lawmakers are critical of Zuma - said a judicial inquiry was crucial in verifying the allegations in the watchdog's report.
"We therefore trust President Jacob Zuma will implement this judgment without delay in the interest of our country," it said.