"One suicide bomber detonated his explosive roughly at 7:00 a.m. (local time) in Char Rahi Qambar locality, Police District 5. As a result, three military personnel and two civilians were killed and 12 people, including five civilians, sustained wounds," the ministry's spokesman Nasrat Rahimi wrote on Twitter.
The spokesman added that the number of casualties may change.
The blast occurred outside Marshal Fahim National Defense University when military cadets and university staff were arriving and waiting to enter the compound, eyewitnesses told Xinhua earlier in the day, adding the nature of the blast was suicide car bombing.
The explosion also damaged several vehicles running along the busy road, they said.
No group has claimed responsibility for the attack yet.
The same university was attacked by a suicide bomber in late May last year, and Islamic State (IS) militants claimed responsibility for the bombing.