
The fire broke out Saturday evening and the workers were trapped inside. Fifteen people died on the spot and two succumbed to injuries overnight in the hospital, local police official Ramesh Singh said.
"They were all poor people who were made to work in unsafe conditions by their employers," Singh said.
The fire raged for hours as firefighters battled to control it. The cause of the blaze was not clear, he said.
Singh said the rooms inside were congested with stored materials including fireworks and flammable raw materials.
"The victims were working in rooms where the materials were also stored," he said.
The victims included 10 women and three children.
The factory owner and his son were arrested, he said.
The accident occurred in Badnagar town of Madhya Pradesh state.
Accidental explosions are not uncommon at Indian fireworks factories which are often simple sheds with inadequate or no emergency equipment.
DPA