Some of the attackers at the Marshal Fahim Military Academy have been killed, an Afghan security source said, in the third major attack in the city in just over a week.
At least four attackers were still involved in an intense gun battle with security forces, the source said, adding the gunmen had not managed to enter the heavily fortified academy.
Three soldiers have been wounded, defence ministry spokesman Dawlat Waziri said.
"One bomber detonated himself and the rest of the attackers are resisting.
They are under siege by our forces," Waziri added.
Witnesses told AFP they heard several explosions and gunfire at around 5am (0030 GMT) at the academy on the outskirts of Kabul where high-ranking military officers are trained.
An AFP reporter at the scene said he could "hear explosions". Security forces have swarmed the area and blocked the road leading to the academy.
An officer inside the academy’s compound said he heard an explosion followed by an exchange of gunfire.
Kabul police spokesman Basir Mujahid confirmed said there had been rocket and gunfire.
There was no immediate claim of responsibility for the raid, which comes days after a Taliban suicide attacker driving an explosives-packed ambulance blew up in a crowded area of the city, killing and wounding hundreds.
At least 103 people were killed and 235 wounded in Saturday’s lunchtime attack -- one of the worst bombings in the city in recent years -- which was followed by a national day of mourning in the war-weary country.
The government has blamed the Taliban-affiliated Haqqani Network, which Afghan and Western officials suspect of involvement in at least some of the recent attacks in the capital.
Today’s raid came as both the insurgents and the Islamic State group have escalated their attacks on Kabul, turning it into one of the deadliest places in Afghanistan for civilians.
On January 20, Taliban insurgents stormed Kabul’s landmark Intercontinental hotel and killed at least 25 people, the majority foreigners.
But there is still confusion over the true toll from that attack with conflicting figures given by officials and Afghan media reporting higher numbers
Kabul is on high alert as the city braces for further attacks. Security warnings sent to foreigners in recent days said IS militants were planning to attack supermarkets, hotels and shops frequented by foreigners. VNS