Speaking at the opening of parliament, Ghani said Afghan forces had dislodged ISIS loyalists from regions of Nangarhar province bordering Pakistan.
"Afghanistan will be their graveyard," he said in an address broadcast live on national television.
ISIS has had a presence in Afghanistan for more than a year. Officials have said most militants calling themselves IS are disaffected Taliban fighters.
Afghan forces have claimed victory following a 21-day operation in the Achin and Shinwar districts of Nangarhar, claiming at least 200 militants killed, a provincial official told The Associated Press.
Achin and Shinwar are among a number of districts in the remote mountainous regions along the Pakistan border that were overtaken by ISIS loyalists in recent months. Operations against the militants included airstrikes to destroy bases and a radio station that was broadcasting IS recruitment messages across Nangarhar province. The radio station was destroyed, along with at least seven militants, on Feb. 1.
"The aim of the operation in Nangarhar was to root out IS from the area," said Afghan Army Lt. Col Sharin Aqa, a spokesman for the 201 Corps.
The operation was aided by local residents who set up checkpoints to help maintain security in their villages. These so-called "local uprisings" had supplemented the Afghan forces, which have been stretched since the drawdown in 2014 of the international combat mission, he said.
The Afghan government is attempting to end the war on its territory with hopes of drawing the Taliban into a dialogue and eventual peace talks. The ISIS presence has been principally in the east, where they have also fought the Taliban for territory.