The explosion took place at the Kaaj education center, in a predominantly Hazara neighborhood.
Students were taking a practice university entrance exam Friday morning when the blast first took place, Kabul Police Spokesman Khalid Zadran told CNN.
Videos posted online and photos published by local media showed bloodied victims being carried away from the scene.
Abdu Ghayas Momand, a doctor from Ali Jinah Hospital, where some of the victims have been taken, confirmed 23 people had been killed and 36 more injured.
Further details of the attack were not immediately available, although the official death toll was expected to rise.
There has been no claim of responsibility for the attack.
“Security teams have reached the site, the nature of the attack and the details of the casualties will be released later,” interior ministry spokesman Abdul Nafy Takor tweeted.
“Attacking civilian targets proves the enemy’s inhuman cruelty and lack of moral standards,” he added.
A string of attacks in Kabul have claimed dozens of lives in recent weeks.