A candidate for a seat on a provincial council was killed, along with an election worker and two policemen, said interior ministry spokesman Sediq Sediqqi.
All five insurgents involved in the attack, which triggered a standoff that lasted more than four hours, were also killed, he said.
The assault was the latest in the insurgents' violent campaign against the country's April 5 elections, when Afghans are to choose their next president and local council members. The Taliban have vowed to disrupt he polls.
Ahmadzai was not at home at the time and was not the target of the attack, officials said, but the local office of Afghanistan's Independent Election Commission.
More From This Section
Police official Sayed Gul Aga Hashmi said the assault started with one suicide bomber detonating his car and the other setting off his explosives' vest. The blasts paved way for other attackers to storm inside the building, Hashimi said.
He said he had spoken to a colleague who was hiding inside the bathroom with seven others and who had told him there were about more employees elsewhere in the building.
Sediqqi later revised the figure to 70 people trapped, after he got more updated information. He said police eventually rescued all but two, the slain candidate for the post of provincial council member and election worker.
The building in Karte Char is in the southwestern Kabul, near the historic war-damaged Darulaman Palace built by Afghan King Amanullah. The landmark palace was heavily damaged during the Afghan civil war and stands empty.
Also today, insurgents carried out attacks on a bank in northeastern Kunar province and on an Afghan outpost in the eastern Khost province, on the border with Pakistan.