Superintendent of Police Jagat Singh said the leakage was reported from an underground tank which was part of the water purifying set-up of the factory, situated in Agra Chowk area of the district.
While two employees were trying to fix it, the gas leak intensified, leading to their death.
Two other workes, who rushed to help their colleagues in trouble, also inhaled the poisonous gas and died, the SP said.
The four workers were taken to the district hospital, where they were declared brought dead, he said.
Singh said a case has been registered against the factory owner and a thorough probe into the mishap will be conducted.