The lone bomber targeted the building in the city's downtown as staff were about to leave for home.
The Ministry of Public Health said 19 people had been killed and more than 40 wounded. Ministry spokesman Ismael Kausi said the death toll could rise.
There was no immediate claim for responsibility for the attack.
Last month, the Taliban claimed they carried out double bombings near the parliament in Kabul that killed 38 people. Buses carrying Supreme Court staff were targeted by a car bomb in 2013 that was claimed by the Taliban.
Tuesday's attack came a day after the UN reported that civilian casualties hit a new high last year, with 3,498 killed.
President Mohammad Ashraf Ghani condemned the bombing. "The enemies of Afghanistan have once again proved their enmity towards the people," he said in a statement.
The Turkish Foreign Ministry condemned the attack. "We have learned with great sorrow that many people were killed and injured today in the terrorist attack perpetrated at the Supreme Court in Kabul," the ministry said in a statement.
"We believe that such heinous terrorist attacks cannot deter Afghanistan from its path towards stability and development and we reaffirm once again Turkey's support to the Afghan government's fight against terrorism."