The attack came despite increased security ahead of a Muslim holy day which last year saw one of the capital's deadliest attacks.
The bombers apparently meant to target the American base but were spotted by security guards as they approached on foot.
The guards fired on the assailants, killing them, but not before one of their vests exploded, said General Mohammad Daoud Amin, the deputy provincial police chief.
Two Afghan security guards were killed and five civilians were injured in the explosion, he said.
The blast reverberated around Kabul's Wazir Akbar Khan district. An alarm started going off at the nearby US Embassy, warning staff to take cover.
The area also is home to many high-ranking Afghan officials, international organisations and the headquarters of the international military coalition. The Taliban claimed responsibility for the bombing in an email to reporters.
The attack came as foreign and Afghan forces tightened their watch over the capital ahead of the holy day of Ashoura on Saturday, when Shiite Muslims commemorate the seventh century death of Imam Hussein, the Prophet Mohammed's grandson.
The bombers were also armed with grenade launchers, said Gen Amin. He said they were stopped near a building which was under construction near the US base.
An international coalition vehicle was also damaged in the attack but there were no initial reports of casualties among the foreign forces, said Jamie Graybeal, a Nato troops spokesman.