The casualty figures were still provisional, the ministry said in a statement.
But it is already the deadliest attack in the country in several months, worse than the December 2007 attack in Algiers against government and UN buildings, which killed at least 41 people and injured many others.
The explosion left a crater several metres across.
"It's utter carnage," said the father of one of those killed in the attack.
"It's a catastrophe. May God punish them for the crime they have committed against these youngsters, and their country."
Another candidate survived because he went to buy cigarettes but his father, mother and brother were killed in the blast, witnesses said.
As well as devastating the entrance to the school, the blast destroyed several nearby houses and blew out windows in nearby shops.
Emergency workers gathered up the remains of the dead, wrapping them in blankets and placing them in waiting ambulances.
More deaths in ambush
Tuesday's attack came as 11 members of Algeria's security forces and a civilian were killed in an ambush by armed rebel groups in the east of the country, Algerian newspapers had reported.
The attack, which took place on Sunday in Skikda, was one of the deadliest in the past few weeks and also left about a dozen security officers wounded, Quotidien d'Oran and Liberte newspapers said on Tuesday.
The papers also reported that four rebel fighters were killed in the attack. No group has yet claimed responsibility for the attack.
One bomb exploded as security forces in a convoy of three vehicles were on patrol in the Skikda region. The blast was then followed by a second bomb.
One of the soldiers killed in the ambush was Lieutenant-Colonel Rahmouni Mohammed, 47, the Algerian newspapers said.