Bangladeshi police said they urged the seven men and one woman to surrender but instead they detonated a grenade to take their own lives.
Up to eight suspected militants have blown themselves up with a grenade north of the Bangladeshi capital rather than surrender, police said on Thursday.
Police urged the militants, in their hideout in Nasirpur, northeast of the capital Dhaka, to give themselves up on Wednesday, but instead they detonated the grenade.
"Up to eight militants, including a female, were killed," Monirul Islam, the chief of police counter-terrorism and transnational crime, told reporters.
On Monday, Bangladesh army commandos killed four suspected militants in the northeastern city of Sylhet during a raid on a building where they were holed up.
On Saturday, six people, including two police, were killed and more than 40 wounded in two bomb blasts near the militant hideout in the Sylhet building.
Daesh claimed responsibility "for a bombing on Bangladeshi forces in Sylhet," the SITE monitoring service said, citing a report on the militant group's news agency Amaq that appeared to refer to that incident.
Daesh and Al Qaeda have made competing claims over killings of foreigners, liberals and members of religious minorities in Bangladesh, a mostly Muslim country of 160 million people.
The government has consistently ruled out the presence of such groups, blaming domestic militants instead.