Deep in the north country woods where the state highway finally turns to dirt, the town of Allagash, lacking perhaps a future, is searching for its past.

The past, for this isolated timbering village, is enshrined in a newly built log cabin, headquarters of the Allagash Historical Society. It is half full of rusty handsaws, rosary beads, copper hinges, old pipes, sheep shears, a family Bible - remnants of a century's simple life.

More than ever lately, people here are tracing genealogies, writing histories and collecting family photographs before they are scattered or lost.

They are pursuing the past because the future of Allagash, as envisioned by the U.S. Army Corps of Engineers lies under water. The proposed Dickey-Lincoln dam, 27 stories tall and nearly two miles wide, would flood the village to generate electricity for New England.

This week, a House-Senate conference committee will decide whether to approve $710,000 to plan the project. The House is opposed. The Senate, in one of the closest water project votes ever, voted 51 to 46 last week to fund it.

Environmentalists, who defeated Tennessee's Tellico dam last week with administration support, are focusing on Dickey-Lincoln as the water project battle of the year. But the Carter administration, which had Dickey on its 1977 "hit list," now is recommending funding.

The stakes in the Dickey fight involve more than New England. If Dickey is stopped, both sides agree, other dams, irrigation projects and federal waterways could be halted.

In a curious twist of politics, Sen. Edmund S. Muskie (D-Maine), known as Mr. Environment for his long support of ecological causes, is the project's strongest advocate. Dickey has become a partisan issue, with Maine's other senator, William Cohen, and its two House members - all Republicans - aligned against it.

Project opponents want to protect the upper St. John, a wild river flowing freely through remote timber country along the Canadian border. The project, larger than Egypt's Aswan, would flood 267 miles of river and streams and 88,000 acres of timber, creating a 57-mile-long reservoir.

It would displace 166 families in and around Allagash, a modest little town of trailers and white clapboard homes strung randomly along a two-lane highway and logging rigs parked on untended lawns.

But Allagash is a place of clannish ethnic pride. Since its settlement in the 1830's, cousins have married cousins, retaining their Scotch-Irish brogue and their independence from the French-speaking, potato-farming towns down the road.

"It's a matter of roots," says Edith Kelley, 55, who lives on her grandfather's homestead by the river. "The descendants of people who settled here still live here. It's a unique way of life. If they built the dam, it would be lost forever."

The people of Allagash hardly were mentioned in the Senate debate over the project. "Sure, they're going to be moved," Muskie said in an interview later. "They'll be the compensated and they'll benefit from the improved economic prospects the dam will bring to the area."

The focus of the congressional struggle is on economics. Opponents call Dickey "a billion-dollar boondoggle," claiming it would provide only 67 cents of benefit for every dollar spent, assuming an 8.5 percent borrowing rate for capital funds.

Rep. Olympia Snowe (R-Maine) calls Dickey-Lincoln "wasteful federal spending."

"[It] will not produce enough electricity to justify its construction costs.... It would increase New England's electrical capacity by only 1.1 percent."

The corps has spent $10 million in the project since it was authorized in 1965, mostly on environmental studies. Meanwhile, Dickey's projected cost has risen from $218 million to $745 million.

It would replace 2.3 million barrels of oil a year, or, as Cohen puts it, "little more then two hours' worth of our national needs." Alternatives, he says, include peak-load pricing to reduce demand, pumped-storage facilities, the revival of existing small dams and the purchase of excess power from Canada, which is building massive new hydroplants.

However, Muskie, who has boosted the project for two decades, said Dickey is "the single most promising energy source for Maine and tnew England. The rising costs of energy increase its importance. At a time of energy crisis, everbody's looking for the cleanest possible source of energy."

At a 3.25 percent interest rate - the rate in effect when the project was authorized - Dickey would provide $2.10 worth of benefits for every dollar spent. At the 6.85 percent interest rate currently authorized by Congress, the benefit-to-cost ratio is 1.2 to one. Environmentalists claim the 6.85 percent rate is unrealistic, but Muskie contends money for the project can be borrowed at that rate.

Muskie adds that Dickey is the only major federal hydroproject proposed for the Northeast. Traditionally, water projects have benefited the South and the West.

Dickey primarily is designed for peaking power. It would store the spring's snow melt, releasing it to produce power during times of high demand. The St. John has little water in summer, fall and winter, so the dam would operate an average of only 2.5 hours a day.

Peak-load pricing is no alternative, Muskie said. Maine already is conserving energy, "but to pretend conservation eliminates the need for developing new energy sources is to be unreal," he added.

The 400,000-member National Audubon Society has made Dickey's defeat its second priority, after passage of a bill to preserve Alaska land. Dickey, it says, would affect 500,000 acres, putting 365 miles of transmission lines through New England and rendering 240,000 acres of timber accessible only from Canada.

The Maine Natural Resources Council calls the Upper St. John valley "an irreplaceable resource of great beauty. Because of the river's purity, size and length and its passage through uninhabited forest lands throughout its length, it is unique in the Northeast."

James R. Connors, 71, a retired power plant technician, has guided fishermen along the St. John most of his life. "People who come here are running away from the dust, from discord and from dams. They're trying to get somewhere quiet. You can dip into this water and drink it. There aren't too many places like that left."

Thirty miles down the road, where the names on the mailboxes change from Kelley and McBreairty to Pelletier and Nadeau, the merchants and potatoe farmers of Fort Kent look forward to the dam.,

Tom LaChance, the largest potato farmer in town, said "a bunch of hippies and lumberjacks who like the wilderness" are opposing the dam. "I'm for progress," he said. "I don't want to live in a tent with kerosene."

Beyond the merits of the issues the regional politics of federal water project development is likely to determine Dickey-Lincoln's fate. Muskie is pointing out to Senate conferees that their favorite projects could be endangered, too. Sen. Bennett Johnston (D-La.), chairman of the public works appropriations subcommittee, is an "enthusiastic" Dickey supporter, Muskie said.

While the close Senate vote makes the outcome unpredictable, Muskie says, "I don't believe those senators interested in water projects in their own states would favor this kind of breach in the dike." CAPTION: Picture 1, Allagash, on the St. John River: Flooding from the proposed Dickey-Lincoln dam would inundate the Maine village. By Patricia Wellenbach for The Washington Post; Picture 2, Edith Kelley, in front of the log cabin that holds a bit of the town's history, is among those in Allagash opposed to the Dickey dam...By Patricia Wellenbach for The Washington Post; Picture 3,...but in nearby Fort Kent, Jim Daigle, noting erosion on the St. John, is one who believes economics and energy are as important as history.