The Taliban claimed responsibility for the attack, saying their fighter had taken down judges who obey Western powers.
President Hamid Karzai condemned the bombing, saying it was another "terrorist act that once again shows the Taliban are serving the enemies of Islam."
The bombing was the deadliest attack in Kabul since December 6, 2011, when a suicide bomber on foot hit worshippers at a Shiite shrine, killing at least 80 people.
Police spokesman Hashmat Stanikzai said the bomber drove an SUV and specifically targeted the buses with court workers. Police said all the victims were civilians or court staff.
More From This Section
The courthouse is on a busy main road in central Kabul, near the US Embassy. The NATO headquarters is also nearby.
Taliban spokesman Zabiullah Mujahid claimed responsibility for the attack, saying in a statement the militants were obliged to attack "cruel judges" who do the bidding of foreign powers.
The Taliban have said they would go after government workers as part of their spring campaign targeting those serving the "puppet" administration of Karzai.
"The Islamic Emirate of Afghanistan was obligated to act against this puppet regime because the people have suffered under the courts," said Mujahid, referring to the Taliban by the name they were known when they ruled Afghanistan.