Union Carbide Corp. agreed yesterday to pay a record $408,500 fine to settle hundreds of contested health and safety violations -- including allegations that it exposed unprotected workers to deadly gases -- at two chemical plants in West Virginia.

The Labor Department's Occupational Safety and Health Administration said the agreement settles 556 alleged violations filed against the chemical giant last year following inspections of its plants in Institute and South Charleston, W.Va.

OSHA originally had sought $1,377,300 in fines for 221 violations -- including 127 described as showing "willful" or deliberate disregard of the law -- at the Institute plant and $90,000 for 335 "willful" violations at South Charleston.

Terry Mikelson, an OSHA spokesman, said the settlement agreement includes the "standard non-admission clause, in which the company accepts responsibility but does not admit guilt."

Mikelson said the "willful" characterization by OSHA of the violations stands as part of the agreement, including one for what inspectors said was a requirement by officials at the Institute plant that workers "sniff" for the presence of deadly phosgene gas when alarms indicated a leak.

"They used to use canaries for that," Labor Secretary William E. Brock said when the first set of citations was issued in April 1986, accusing the company of blatantly violating safeguards to protect workers.

Phosgene was a major ingredient of mustard gas, which was widely used as a weapon in World War I.

Union Carbide President Robert Kennedy had called Brock's remarks "an outrageous misrepresentation of the truth."

But company officials said yesterday that continuing to fight the charges before Labor Department law judges and possibly later in court would cost several times the amount of the settlement.

"In settling this case, we specifically denied any violation of the law," said Harvey Colbert, a Union Carbide spokesman. "We particularly dispute OSHA's contention that any of our employes were required to be exposed to phosgene."