Country's Ministry of Interior (MoI) spokesman Najib Danesh was quoted as saying by Pajhwok Afghan News that police were dispatched to the site of the suicide attack.
He said an attacker blew himself up in a kitchen inside the mosque as he stopped by the police.
The incident left 15 people injured.
Chief Executive of the Islamic Republic of Afghanistan Abdullah Abdullah tweeted: "Attack on praying Muslims inside a mosque in the holy month of Ramadan is against faiths, religions and beliefs. I condemn this enemy act!."
"I thank and praise our security forces for their bravery and courage they showcased to destroy enemies and save our citizens. Bravo! #Kabul," he said.
Several blasts and suicide attacks have hit the city in recent times.
No group has claimed responsibility for Thursday's blast.