KABUL, Afghanistan — With Afghanistan’s foreign backers set to meet next month in Chicago, President Hamid Karzai ordered the appointment of a special prosecutor and the creation of a special tribunal to try those involved in the near collapse of Kabul Bank, a scandal that laid bare the crony capitalism and corruption that has thrived here in the past decade.

Mr. Karzai also ordered that hundreds of millions of dollars in outstanding loans by the bank be repaid within two months, his office said in a statement. Most of the loans were taken by politically connected insiders — including the president’s brother Mahmoud Karzai — and investigators have said that few of the loans were ever meant to be paid back.

Cleaning up the financial and legal mess created by the government’s nearly $900 million bailout of Kabul Bank — a sum almost equal to the government’s annual revenue — has been seen inside and outside Afghanistan as a test of President Karzai’s willingness to tackle Afghanistan’s widespread corruption.

The bank, once Afghanistan’s largest, was seized by regulators in August 2010 after being left dangerously overexposed by shareholders who used it as virtual piggy bank, doling our loans to themselves, friends, relatives and business associates. Western officials have described it as little more than a Ponzi scheme.