The bomber detonated the device in the parking lot as employees were boarding a bus to go home.
The bomber, who was on foot, detonated the device in the parking lot as employees were boarding a bus to go home, interior ministry spokesman Najibullah Danish told AFP.
The casualty figures came from health ministry spokesman Waheed Majroh, who said women and children were among the wounded.
Police blocked off the road around the compound as panicked relatives of court employees began to gather and ambulances and fire trucks arrived.
The compound is sited on the road leading from Kabul international airport to the US embassy.
Last month twin suicide blasts claimed by Taliban insurgents tore through employees exiting a parliament annexe in Kabul, killing 30 people and wounding 80.
The carnage underscores growing insecurity in Afghanistan, where local forces are struggling to combat a resilient Taliban insurgency as well as Al-Qaeda and Islamic State militants more than two years after NATO's combat mission ended.
On Monday the United Nations said civilian casualties in Afghanistan in 2016 were the highest recorded by the world body, with nearly 11,500 non-combatants -- one third of them children -- killed or wounded.
Earlier this month an official US watchdog said the death rate among Afghan troops and police soared last year as the government's overall control of the country declined significantly.
The grim new statistics paint a picture of a beleaguered nation still in the grip of a security crisis, despite many years and billions of dollars spent building up Afghanistan's army and police.
No group has yet claimed responsibility for Tuesday's attack, but the Taliban have targeted the court previously. They killed 15 civilians with a suicide car bomb at the entrance to the compound in 2013.
At the time the insurgent group threatened further attacks on the judiciary if it continued to sentence its militants to death.