The militants were cornered in an early morning raid on their hideout in Naraynganj, on the outskirts of the capital, and were killed after refusing to surrender, Additional Commissioner of Police Monirul Islam said.
Bangladesh-born Canadian citizen Tamim Ahmed Chowdhury, the alleged mastermind of the attack on the cafe, was among those killed.
Islamic State had claimed responsibility for the cafe attack and, while the government has dismissed the claim, security experts say the scale and sophistication of the assault suggested links to trans-national networks.
Analysts say Islamic State in April identified Chowdhury as its national commander.
The suspected Islamist militants singled out non-Muslims and foreigner hostages in the July 1 evening attack, killing Italians, Japanese, an American and an Indian before security forces stormed the eatery to end the 12-hour siege that has weighed on Bangladesh’s multi-billion-dollar garments industry.
The government says the July 1 attack – and another on July 26 in which police killed nine militants believed to be plotting a similar assault – were the work of domestic militants.