There was no immediate word on casualties, nor was there any claim of responsibility.
Two loud explosions and gunfire were heard coming from the vicinity of the ministry compound and police officials inside said they believed it was a terror attack.
A senior police official said a car bomb was detonated near the ministry's entrance and then a gun battle between attackers and members of the security forces broke out.
A series of deadly attacks in Kabul this year have killed and wounded hundreds of people.
Provincial cities have also been hit as the Taliban, seeking to reimpose hardline Islamic rule, have stepped up fighting across the country since they announced the beginning of their annual spring offensive in April.
The latest violence coincided with a US government report that found few signs of progress in Afghanistan this year, with fighting spreading and hundreds of casualties from militant attacks.
Security officials say violence is expected to pick up as preparations continue for parliamentary elections scheduled for October.