A $2.5 million criminal fine announced this week against Conrail Inc. for polluting the Charles River could not have come at a worse time for the carrier, which is in the midst of a Massachusetts political battle for funds to upgrade service in the state.

Under an agreement with federal authorities, the Philadelphia-based rail carrier said it would plead guilty to six counts of violating environmental laws by dumping oil and grease into the river from its Beacon Park yard in the Allston district of Boston.The penalty, the largest environmental fine in Massachusetts history, follows an admission that the yard intentionally operated a faulty separator system and discharged storm water mixed with illegal levels of oil into the river.

A rower on the Charles River, which is also home to neighboring Boston University, spotted the spill in April 1994, leading to investigation of similar incidents in two previous years, federal officials said. Conrail also admitted that it ran the separator after its permit expired.

"Conrail is frankly embarrassed by the spill and the permitting violations that occurred at Beacon Park," said David M. LeVan, Conrail's president and chief executive.

"Conrail is finding out the hard way what happens when you play fast and loose with New England's environment," said John DeVillars, regional administrator for the Environmental Protection Agency. "This case ought to send a clear message that we will not stand for anyone treating this river like an urban cesspool."

The public rebuke comes at a crucial time for Conrail, which has been fighting for Gov. William F. Weld's plan to develop Beacon Park for double- stack operation, using funds from a pending $110 million capital outlay. The double-stack funds, part of a $292.2 million seaport bond bill, were approved by the House. The bill is expected to be taken up by the Senate Ways and Means Committee next week.

The funds would help to raise bridge clearances throughout Massachusetts, benefitting Conrail as well as the Providence & Worcester Railroad Co. and Guilford Transportation Industries Inc.

But a university-backed real estate venture, Halberson Associates, has tried to block the plan with a competing proposal to build dormitories, stores and offices at Beacon Park.

The conflict has taken on strong political overtones, in part because BU's president, John Silber, ran unsuccessfully in 1990 as the Democratic gubernatorial candidate against Mr. Weld, a Republican. The partisan ties have reportedly caused some Democratic lawmakers to balk at supporting the rail plan.

One industry official, who spoke on condition of anonymity, voiced skepticism about the timing of the announcement. Both Mr. DeVillars and U.S. Attorney Donald Stern are former top aides to the state's last Democratic governor, Michael S. Dukakis.

Officials representing both men denied any political connection to the pollution case.

"There's no politicking whatsoever involved," said Alice Kaufman, spokeswoman for Mr. DeVillars. "He said it's the most preposterous thing he ever heard."

"It's just unfortunate timing for Conrail, but we just want to state that the two things are totally separate," said Anne-Marie Kent, a spokeswoman for Mr. Stern, referring to the stack plan before the Legislature.

"From our perspective, there is no evidence whatsoever that the two are linked," said Richard W. Husband, a spokesman for Conrail. "Could the timing have been better? Sure."

Although BU may now be able to argue that Conrail is not a good neighbor

because of the pollution case, it has so far refused to address the matter publicly. Both Kevin Carleton, a spokesman for the school, and Larry Rasky, a Democratic lobbyist representing Halberson, declined comment on the announcement.

But questions remain about the timing of the fine. Dianne Chabot O'Malley, an EPA enforcement counsel, said Conrail failed to file required discharge monitoring reports for the separator equipment between 1987 and 1992.

The state Department of Environmental Protection warned Conrail in July 1992 about the filings, which were then submitted and showed violations, said Ms. O'Malley. But the EPA was either not informed or took no notice. Ms. O'Malley also could not confirm a report that the Coast Guard investigated a release from Beacon Park in 1992.

It was not until the rower reported the slick on the Charles in 1994 that the EPA began its investigation and discovered the earlier discharges, Ms. O'Malley said.

Although the unidentified rower and Mr. DeVillars are both members of Boston's Union Boat Club, they did not know each other, said Ms. Kaufman. The club is private and not affiliated with BU, an official there said.