"The bomber killed himself in front of the compound. Two people were killed and two more were wounded, all Afghan guards," said Interior Ministry spokesman Najib Danesh.
A second man wearing an explosives-laden vest also approached the front of the compound but was shot dead by Afghan security forces. Five civilians were also wounded.
The bomber struck near the sprawling base known as Camp Eggers, the headquarters of the NATO training mission and home to some 2,500 trainers from the multinational coalition.
Dozens of police swarmed to the area, where shattered glass from cars lay on the ground, and cordoned it off.
The Taliban took responsibility for the attack, which happened at 8.20am.
Violence is intensifying across Afghanistan ahead of the planned withdrawal of most foreign troops by the end of 2014, sparking concerns over how the 350,000-strong Afghan security forces will be able to manage.
At least a dozen embassies, including the US and British missions, and the headquarters of the NATO-led International Security Assistance Force (ISAF) are all near the area of the attack.