Local residents said they heard gunfire and several explosions but police said there were no civilian casualties.
The attack on the large compound, known as the Green Village, is the second this week targeting foreign workers.
On Monday, two Afghan security guards were killed in a Taliban attack on another Western compound.
"Four suicide bombers have been killed, there was no harm to civilians," Deputy Interior Minister Mohammad Ayub Salangi told reporters.
A Taliban spokesman said the group was behind the attack.
The attackers tried to break into the Green Village by detonating a car packed with explosives at the entrance to the compound, which houses foreign contractors and security staff.
"Since the Green Village had been targeted several times in the past, the place was heavily guarded and the attackers failed to reach their intended target," Interior Ministry spokesman Sediq Sediqqi said.
The compound was last targeted in October 2013 when a suicide bomber killed two passers-by. Another attack in 2012 killed seven guards and civilians.
Attacks on foreign workers, government officials and security forces have intensified in recent weeks as Western troops end their operations.
Last week, a suicide bomber targeted a prominent female Afghan politician, killing three civilians and wounding others in an attack on a Kabul convoy.
A week earlier, another suicide attacker entered the offices of Kabul's police chief and killed a senior officer.
Officials in Kabul say police killed four Taliban suicide bombers during an attack on a compound housing foreign workers in the Afghan capital.