"Around 10:10 am, a group of armed attackers entered an under-construction building in (the) NDS training centre in (the) Afshar area of Kabul," interior ministry spokesman Najib Danish told AFP, referring to the National Directorate of Security, Afghanistan's spy agency.
"The fighting is ongoing and we have also launched our operation."
There were no immediate reports of any casualties.
Nasrat Rahim, a deputy interior ministry spokesman, said the sound of large and small arms fire could be heard from the fighting.
No group has claimed responsibility for the attack yet. Previously both the Taliban and, increasingly, the Islamic State group have carried out devastating attacks in Kabul.
In November, a suicide attacker blew himself up outside a political gathering in Kabul, killing at least 14 people. The bombing was claimed by the Islamic State group.