The attack was followed by another on an intelligence service in the capital.
Thirty-four people have been killed after a suicide bomber targeted students preparing for university exams in a Shi'ite area of the Afghan capital Kabul.
The death toll was revised down from 48 as the health ministry said some bodies had been double counted.
The explosion, targeting an educational centre in the west of the Afghan capital, tore through a large tent set up as a classroom in the courtyard, also wounded at least 56 people.
Islamic State claimed responsibility for the blast, which killed mostly students attending an English class, said Reuters.
It comes as the latest in a wave of attacks that have killed hundreds of civilians, soldiers, and policemen over recent days.
The Shia community in Afghanistan has been repeatedly targeted by Sunni Muslim extremists of the Islamic State group, which views the Shia practice of Islam as heretical.
On the same day, the Taliban said it could no longer guarantee safe passage for Red Cross staff working in Afghanistan, amid a row over the treatment of Taliban prisoners in a jail in Kabul.
A separate attack on an intelligence service centre followed hours afterward in the capital, though there have been no reports of casualties or claim of responsibility so far.
The attacks come as the central city of Ghazni struggles to recover from intense fighting between the militant group and government forces.
It underlines how badly security in Afghanistan has degenerated, some two months before parliamentary elections scheduled for October.
The United Nations Assistance Mission in Afghanistan called for the fighting to stop, saying up to 150 civilians are estimated to have been killed in Ghazni, where the public hospital was overwhelmed and water and electricity supplies cut.
"The extreme human suffering caused by the fighting in Ghazni highlights the urgent need for the war in Afghanistan to end," said top U.N. official in Afghanistan, Tadamichi Yamamoto.