Beyond the blueberry-covered hills and white church spires, humpback whales shimmer through the mauve waters of Cobscook Bay. More bald eagles than anywhere else in the northeast nest along this rocky, spruce-wedged coast.

For seven years, the Pittston Co. of New York has tried to build a giant oil refinery on this farthest edge of the eastern seaboard. Now the federal government has stopped the project because oil spills, increased population and emissions of mercury, sulfur dioxide and other pollutants might harm the eagles and whales, both endangered species.

The Pittston saga is a case study of the regulatory, environmental and economic problems surrounding energy development in the United States.

In the last two decades, more than 30 attempts to build refineries on the East Coast have failed. Pittston's, which would, if built, be the first major refinery in oil-starved New England, is one of only two ongoing East Coast proposals. The other, a Portsmouth, Va., project, also is being held up on environmental grounds.

But the 250,000-barrel-a-day Pittston plant is not dead yet. The Environmental Protection Agency denied it a water pollution permit after the Interior Department, protector by law of the eagles, and the Commerce Department, guardian of the whales, said the refinery would violate the 1972 Endangered Species Act.

The company has applied for an exemption to the act. A three-member board, composed of an administrative law judge, a Harvard professor and a Portsmough businessman, will hold public hearings in Washington, D.C., this week on whether the refinery and the endangered species are in "irreconcilable conflict."

Even if it wins on that issue, Pittston faces uphill battles on other fronts:

The Roosevelt-Campobello International Park Commission has challenged the issuance of an air pollution permit by EPA to the company in the U.S. Circuit Court of Appeals. The park, summer home of Franklin D. Roosevelt, is a mile downwind of the refinery site. The commission vice chairman, Sen. Edmund S. Muskie (D-Maine), strongly opposes the project. The Justice Department, which is defending the issuance of the air pollution permit, also is funding the park challenge.

A 1975 site permit issued by Maine under protest by state environmental groups will expire soon. Pittston has applied for a new permit and has asked for a waiver of one of the conditions of the current permit - the state's requirement for double hulls on tankers. New public hearings are scheduled.

Pittston tankers must traverse Canadian waters to reach the refinery, but Canada says it won't allow them through. The oil spill risk to Canadian fisheries is "unacceptable," the embassy said last week. Refinery critics predict an "ugly international incident" if Pittston persists.

Six years of regulatory roller-coasting has worn the company's patience thin. The cost of the project has jumped from $350 million to $750 million. "It's a day-to-day decision as to whether we continue" the fight, said Jonathan Hill, the company's Washington lawyer.

Arnold F. Kaulakis, Pittston's vice president, says the permit delays "are symptomatic of what is wrong with our nation's economy today and why industry is reluctant to make new investments in many areas."

While government and industry are tangled in red tape, the people of Maine are deeply divided over the refinery. Life along the seaboard is hard - long winters, few jobs. The soil yields grudgingly. The sardine canneries in this town of 2,000 closed long ago, as fishing declined.

Everett Baxter, town manager, remembers when 6,000 persons lived here before World War I and the port was a busy trading center. "I've seen it go downhill. We have 20 percent unemployment. Four hundred families get food stamps. No industry is clean. We have to take what we can get . . .

"Those opposed are people who have retired and have an income. They belong to the Sierra Club. They have money to recreate. They don't want other people to make a living."

But on a sunny day last week, Rex Look, 18, busy making a living digging clams outside Eastport, paused to look over the day. "This wouldn't be too pretty if there was an oil slick," he said. "Are we going to hurt the wildlife just so some fat guy from New York can make a million dollars?"

At a stormy public hearing at the local high school last March, eagle and whale partisans rallied.

Pittston "is attempting to pull a fast one on some of us dumb Down East farmers," said Dale Sherrard of nearby Charlotte. "I take this kind of personally because I happen to like to look up in the air and see those eagles flying . . . The eagle is the national symbol beacuse it represents freedom, freedom to exist in the environment without Pittston's pollution."

At the eye of the conflict is Frank Gramlich, the U.S. Fish and Wildlife Service's Maine officer, who, with a team of biologists, issued a formal opinion that the refinery "is likely to jeopardize the continued existence of the bald eagle."

Gramlich, 59, a tattooed woodsman, has watched the eagle population slowly recover from the effects of DDT, the pesticide that rendered the birds sterile, victually halting eagle reproduction in the 48 contiguous states for two decades.

On a boat ride around the refinery site last week, it wasn't hard to spot a half-dozen eagles, the white-breasted young perched on high nests, the parents soaring overhead in a slow motion search for prey.

Maine has 58 eagle nests, the only nests in the nine states north of Maryland. Cobscook Bay is Maine's most productive nest area, accounting for a quarter of all hatchings in the northeast. Eagles are endangered or threatened in every state except Alaska.

"I'm not against oil refineries," Gramlich said. "But I'd like to see it built in Portland or some place where it would cause less environmental destruction." A trace of oil on an eagle's feather, if rubbed on an egg, will prevent hatching, he said. And "any additional mercury would definitely affect reproduction."

Pittston's Kaulakis, however, says, "We see no valid reason to believe the eagles and refinery cannot coexist." He said that the plant will scrub mercury and lead from its emissions and, in case of an oil spill, will set out uncontaminated eagle food.

Critics ridicule such plans as "Pittston's golden arches."

The refinery, which could meet 19 percent of New England's gasoline and heating oil demands, also is being questioned on economic grounds. A General Accounting Office report this month contended that no new U.S. refineries are needed because major oil firms already have enough refining capacity in Europe and the Caribbean.

Pittston's critics add that three Canadian refineries, including one 50 miles north of Eastport, have more capacity than is being used.

However, the Department of Energy, which says the East Coast needs five to 10 new refineries, strongly backs Pittston.

"The federal government is stockpiling crude oil," a DOE spokesman said. "In times of emergency or embargo U.S. refineries will be expected to process this crude . . . We cannot overemphasize the consequences of increased dependence on foreign refinery capacity in terms of balance of payments, national security and do mestic employment."

The Pittston situation is the third major confrontation between an endangered species and a large development. The first, when the Tennessee Valley Authority's Tellico Dam threatened to extinguish the snail darter fish, resulted in the halting of the dam. The second, when a Wyoming power plant would have harmed whooping cranes' mating grounds, resulted in a modification of the project.

While the snail darter case sparked widespread criticism of the endangered species law, federal officials say whales and eagles have a wider constituency.

"This isn't a three-inch fish," said one Interior Department economist. "This is the national symbol."