In a statement released late Saturday via the Nashir News Agency, which publishes the terror group's official propaganda, accused the imam, identified as Mohammad Numan, of encouraging the fight against jihadis, reports dpa news agency.
"Soldiers of the caliphate" had planted an explosive device in the mosque, said the statement.
The authenticity of the statement could not be independently verified.
At least 15 others were wounded in the attack in Kabul province's Shakar Dara district during the Eid-ul Fitr festival to mark the end of Ramadan on Friday, according to Afghan security officials.
The attack took place as the Afghan government and the Taliban were holding a ceasefire for the Islamic Eid holidays.
The ceasefire ended at midnight on Saturday.
The IS has recently lost territory, leaders and other fighters in Afghanistan.
In addition to the Afghan government, the Taliban are also fighting the extremists.
According to a UN report, the terrorist group is still able to carry out attacks in various parts of the country.