CHICAGO, JULY 27 -- USX Corp. has agreed to pay $34 million in costs and penalties for the cleanup of wastewater that was illegally dumped from its Gary, Ind., steel mill, federal officials said today.

The agreement stems from a 1988 lawsuit filed by the federal government alleging that USX for a number of years had bypassed its treatment system and discharged wastewater contaminated with ammonia, cyanide and heavy metals into the Grand Calumet River, which empties into Lake Michigan.

USX discharges 350 million gallons of wastewater and cooling water into the river daily and it is not known what percentage did not pass through the treatment system.

The suit also alleged that the company had made other violations of the federal Clean Water Act, including failing to report the discharges to the Environmental Protection Agency and failing to pretreat certain wastes sent through a Gary treatment facility.

Under the agreement, the company will pay $1.6 million in penalties and an estimated $25 million to upgrade its waste-management facilities, officials from the EPA and the U.S. attorney's office said at a news conference in Chicago, where the lawsuit was filed.

The penalty is one of the largest assessed against violators of the Clean Water Act. The company also agreed to pay $2.5 million for a study to determine the extent of sediment contamination in the Calumet and an additional $5 million to clean up whatever contamination is found.