The Senate struck a fragile compromise yesterday on a formula to divide billions of dollars for sewerage construction and approved a long-delayed extension of the nation's Clean Water Act.

The extension, approved 94 to 0, toughens the act in several areas but preserves a delicate balance among demands of environmentalists, Alaskan loggers, senators from some states bordering the Great Lakes and small-state northeastern senators who dominate the Senate Environment and Public Works Committee.

Under one provision, states must determine which bodies of water do not meet current water-quality standards. After three years, they must "institute measures beyond existing technologies" to do the job.

Environmentalists hailed this and other provisions. "We think it's a great bill," said Fran Dubrowski of the National Resources Defense Council. "It holds the line against a host of weakening amendments. It's a real victory for the environment."

The extension became a grab bag of pet projects. Illinois Democrats Alan J. Dixon and Paul Simon requested funding for a sewerage project to aid Chicago suburbs, Minority Leader Robert C. Byrd (D-W.Va.) sought incentives for coal-mine operators to remine old sites, and Alaska Republicans Ted Stevens and Frank H. Murkowski demanded language to make it easier for Alaskan loggers to obtain federal permits.

The debate also pitted small-state senators against big-state colleagues, who have traditionally received the most federal sewerage-project money. The battle over that funding formula threatened to kill the package until senators agreed to a complicated formula that will give some states a little more money and others a little less.

Haggling over the funds was intensified by the fact that federal money to build water projects is scheduled to be phased out over the next five years.

Senators agreed that the final bill was dictated more by practical politics than by the stated goal of achieving fishable, swimmable waters.

"It's the best we could work out," said Sen. John H. Chafee (R-R.I.), who helped negotiate the compromise. "We are dealing with 100 senators, all of whom are diligent . . . in protecting the interests of their state.

"Like all compromises," he added, "this doesn't make everybody happy. But I think it's a reasonable one."

Under the new formula, 18 states, which have the greatest water-pollution problems and receive most of the money, stand to lose as much as 15 percent of current grants for each of the next three years. Thereafter, they could lose more.

Many states in the South and West, will receive as much as 20 percent more than they now receive.

Senators from the largest midwestern states bordering the Great Lakes expressed displeasure at the prospect of losing federal money. But, as Sen. Carl Levin (D-Mich.) explained to his colleagues: "We counted votes. Counting the votes, we decided we didn't have it, so we decided to negotiate."

Sen. John C. Danforth (R-Mo.) tried to block the compromise, under which Missouri would lose about $7 million. He called the horse-trading "unconscionable" and added, "The way to start a brouhaha on the floor of the Senate is to have some states trying to rip off other states for their own benefit."

Danforth was talking to Chafee and Sens. George J. Mitchell (D-Maine) and Robert T. Stafford (R-Vt.), who led the floor fight for the act, and who represent states that will see an increase in federal funds.

Two other provisions of the extended Clean Water Act are a measure to establish a special office to study the Chesapeake Bay and coordinate environmental programs there, and one to fund a program to fight "nonpoint" source pollution that does not come from factory pipes discharging into the water.

The amendment from Stevens and Murkowski allows Alaskan logging facilities to go through a one-step process for permits to drop their logs from helicopters into rivers. They now need separate permits from the Environmental Protection Agency and the Army Corps of Engineers, a process Stevens said is driving the small, family-owned logging industry out of business.