At least five attackers gunmen and suicide bombers launched the pre-dawn raid claimed by the ISIS group on January 29, killing 11 soldiers and wounding 16.
"Seven high-ranking officers including two generals committed professional negligence. All seven are sacked and referred for further investigations," Ghani said on Twitter after a probe into the incident.
Ghani's US-backed government is under growing public pressure to improve security in the capital after a series of attacks demonstrated the ability of the Taliban and ISIS group to strike at the heart of the country.
Since January 20, militants have stormed a luxury hotel, bombed a crowded street and raided the military compound in Kabul, killing more than 130 people.
The assaults, including a devastating ambulance bomb attack that killed more than 100 people and wounded hundreds, have left already war-weary citizens grief-stricken and angry as the Taliban and IS escalate their offensives.
The National Directorate of Security, Afghanistan's spy agency, on Tuesday seized a truck it said was carrying two tonnes of material which could be used to make bombs.
The truck was travelling from Kabul to the northern province of Parwan where the US Bagram airbase is located, an official said
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)