Top counterterrorism official Monirul Islam said police raided a two-story house in Narayanganj district near Dhaka and killed the suspects early Saturday.
The dead included Tamim Chowdhury, a Bangladeshi-born Canadian, who police believe was one of two masterminds of the attack on a popular restaurant in Dhaka.
Police said they opened fire after the suspects started firing when the raid began, according to AP.
The cafe attack began on 1 July when the militants entered the Holey Artisan Bakery in Dhaka.