The loyalists of the terror group released a formal statement through the Amaq news agency which is frequently used by the main group in Syria and Iraq.
A picture of the alleged assailant was also released by the terror group besides the statement in Arabic language.
The attack on Sakhi shrine was launched around 7:20 pm after the gunman stormed into the gathering of the Ashura mourners, taking several people hostage following the shooting spree.
The gunman continued to fight the Afghan security forces for several hours before he was shot dead by the security.
The Ministry of Interior (MoI) officials earlier said at least 14 people were killed and 36 others were wounded but the death toll climbed on Wednesday.
This is not the first time the loyalists of the terror group have claimed responsibility behind deadly attacks in the country.
The group earlier claimed the attack on a major demonstration in Kabul that left at least 85 rally participants dead and scores of others wounded.