The group, which controls territory across Syria and Iraq, has made alarming inroads in Afghanistan's eastern Nangarhar province, as the country grapples with a resurgent Taliban insurgency.
IS jihadists claimed responsibility for a deadly gun and bomb siege targeting the Pakistani consulate in eastern Jalalabad city on January 13, the group's first major attack in an Afghan city.
In recent months Afghan forces backed by US drones launched a scorched earth offensive to beat back IS in Nangarhar, where the group's rein of terror has displaced thousands of people.
"Afghans are now motivated by revenge. They (IS) have confronted the wrong people," Ghani said on the sidelines of World Economic Forum in the Swiss resort of Davos.
Also Read
The US State Department earlier this month formally designated the group's affiliate in Afghanistan and Pakistan -- which calls itself "Khorasan Province" -- as a terrorist organisation.
The name Khorasan refers to a historic region which includes parts of modern-day Afghanistan, Pakistan and neighbouring countries.
The jihadists have managed to attract disaffected Taliban fighters increasingly lured by the group's signature brutality.
In a sign of their growing reach in Afghanistan, the group has taken to the airwaves with a 90-minute Pashto-language radio show called "Voice of the Caliphate".
The government has said it is trying to block the broadcast, which is beamed from an undisclosed location and aimed at winning new recruits.
"They have committed unspeakable atrocities there... We are starting to drive them out.