SAVAR, Bangladesh — On the worst days, the toxic stench wafting through the Genda Government Primary School is almost suffocating. Teachers struggle to concentrate, as if they were choking on air. Students often become lightheaded and dizzy. A few boys fainted in late April. Another retched in class.

The odor rises off the polluted canal — behind the schoolhouse — where nearby factories dump their wastewater. Most of the factories are garment operations, textile mills and dyeing plants in the supply chain that exports clothing to Europe and the United States. Students can see what colors are in fashion by looking at the canal.

“Sometimes it is red,” said Tamanna Afrous, the school’s English teacher. “Or gray. Sometimes it is blue. It depends on the colors they are using in the factories.”

Nearly three months ago, the Rana Plaza factory building collapsed, killing more than 1,100 people, in a disaster that exposed the risks in the low-cost formula that has made Bangladesh the world’s second-leading clothing exporter, after China, and a favorite of companies like Walmart, J. C. Penney and H & M. That formula depends on paying the lowest wages in the world and, at some factories, spending a minimum on work conditions and safety.