Jawad Ghawari, a member of the city's Shiite clerical council, blamed the Islamic State group for the attack, which carried all the hallmarks of past IS attacks that have hit Shiites mosques, schools and cultural centers.
"The nature of the explosion is not known yet", police spokesman Hashmat Stanikzai said.
Fighting appeared to have ceased in the provincial capital, just two hours drive from Kabul, almost a week after the Taliban first launched their assault late Thursday, in the process destroying telecommunications towers and slowing the flow of information from the city to a trickle.
It was not immediately clear how the bomber managed to sneak into the building, used by the Shiite community as an education centre, in the Dasht-i Barcha area of Kabul. He warned the toll could rise.
Around a dozen ambulances rushed to the Mawoud education center in the western part of the city, where students and relatives described pulling bloodied victims from the rubble of a classroom that had been crowded with teenagers preparing to go to university.
The spokesman, Najib Danish, says at least 35 people were also wounded in the attack on Wednesday afternoon.
The Afghan Army prioritized transporting captured ISIS fighters to Kabul over re-supplying one of its bases in the northern Faryab province that the Taliban had been besieging for weeks, according to a New York Times report.
In his most detailed comments on the Taliban's assault on the eastern city of Ghazni since it began August 10, Mattis said the Taliban had six objectives in and around the city and failed to seize any of them.
Aretha Franklin Dies at 76
Aretha's first music school was the church and her performances were powered by what she learned there. He said the two have talked about her health over the years and said she is "a remarkable woman".
There was no immediate claim of responsibility for the attack, which was swiftly condemned by President Ashraf Ghani in a statement.
Elsewhere in Afghanistan, four policemen were killed and four were seriously wounded late Wednesday when they tried to defuse a vehicle bomb they found in southern Kandahar province, according to Zia Durrani, provincial police spokesman.
"What's crystal clear is that almost four years after the Afghan security forces took over the war efforts, they're still woefully unprepared for the task-despite very real improvements in capacities in recent years".
At least nine security forces were still missing and four others were wounded in the attack, said Abdul Hai Nemati, the governor of Baghlan.
Afghanistan is littered with unexploded ordnance left by decades of war.
The Taliban's five-day siege of Ghazni eased on Wednesday after Afghan officials declared that they had regained complete control of the city by killing hundreds of Taliban fighters. The Taliban hung on in Ghazni for almost five days before US-backed Afghan forces flushed them out.
The Taliban launched a co-ordinated offensive last Friday, overwhelming the city's defences and capturing several neighbourhoods.
"Everyday we are witnessing deadly attacks in Kabul and other major cities".