Islamic State have now claimed responsibility for the attack through their news media agency AMAQ.
Earlier in the day the Taliban's main spokesman issued a statement on Twitter denying involvement.
Interior Ministry spokesman Najib Danesh said a bomber on foot approached the centre where officials had been issuing identity cards as part of a process of registering voters for the election scheduled for October.
A spokesman for the ministry of public health said at least 31 people were confirmed dead and 54 wounded. The explosion destroyed cars and shattered windows in nearby buildings, leaving rubble strewn across the street.
"There were women, children. Everyone had come to get their identity cards," said Bashir Ahmad who had been nearby when the attack took place, after weeks of relative calm in the capital.
The blast took place in Dasht-e Barchi, an area of western Kabul inhabited by many members of the mainly Shi'ite Hazara minority, which has been repeatedly hit by attacks claimed by Islamic State.
Voter registration centres have been set up across Afghanistan ahead of long-delayed parliamentary and district council elections due to be held in October and there have been serious concerns that militants might attack them.
President Ghani has been under heavy pressure from his international partners to ensure the elections are held this year, ahead of a presidential election due in 2019 although there has been widespread scepticism that they will take place.
Unless the process of registering millions of voters, many of whom do not have national identity cards, can be completed before winter sets, the vote would almost certainly have to be postponed until next year.