General John Nicholson said the offensive in the eastern province of Nangarhar was part of U.S. operations to degrade the capabilities of Islamic State wherever it raised its head, whether in Iraq and Syria or in Afghanistan.
The group, believed to be confined to three or four of the more than 400 districts in Afghanistan, last month claimed responsibility for bombing a demonstration by the Shi'ite Hazara minority in the capital, Kabul, in which at least 80 people were killed.
Nicholson, in New Delhi for talks with the Indian military which has provided training and some arms to Afghanistan, said Afghan forces supported by the United States had just carried out a counter-terrorism operation against Islamic State.
"They killed a number of top leaders of the organization and upto 300 of their fighters," he told reporters.
"Obviously it's difficult to get an exact count, but what this amounts to is about 25 percent of the organization at least, and so this represents a severe setback for them."
Islamic State first appeared in Afghanistan at the beginning of 2015, and had about 3,000 fighters at the height of the movement, many of them former members of militant groups such as the Pakistani Taliban and the Islamic Movement of Uzbekistan.
Previously considered a much smaller threat than its bitter enemies the Taliban, the group's bomb attack in Kabul underlined how dangerous it could be, even without holding large tracts of territory.
On Tuesday, another U.S. military official said American soldiers helping Afghan troops fight Islamic State in Nangarhar were forced to abandon equipment and weapons when their position came under fire.
Fighters from the group had circulated photographs of a rocket launcher, grenades, ammunition, identification cards, an encrypted radio and other equipment they said they had seized.
By being more aggressive, the Afghan military were more successful this year against the Taliban than in 2015, when they lost 5,000 men, Nicholson said.
The killing of Afghan Taliban chief Mullah Mohammad Akhtar Mansour in a U.S. drone strike in Pakistan had been a greater blow to the group than they had let on, partly because the Taliban were having trouble getting control of the finances he dealt with, Nicholson said.