About five years ago, two Maine Indian tribes and ther lawyers came to the Justice Department in Washington with what sounded like a preposterous request:

Help us in a lawsuit to recapture millions of acres of land illegally taken from our ancestors a couple of centuries ago.

The Justice Department's reaction was a mixture of disbelief and patronizing humor. "They looked at us as if we were out of our minds," an attorney for the Indians recalls.

After five yars and a key court decision, Justice now is prepared to launch one of history's biggest lawsuits, affecting 90,000 landholders and at least 5 million acres of Maine, all in behalf of the once-spurned Penobscot and Passamaquoddy tribes.

The key to that turnabout is Assistant Attorney General Peter R. Taft, a nephew of the late Sen. Robert Taft of Ohio and a grandson of President William Howard Taft. Taft more than anyone else has shaped the suit the government is scheduled to file for the Indians this summer. He also has marked the outlines for a possible out-of-court settlement he hopes can be achieved by Congress and the White House.

As Taft explains the department's changed view, it didn't result from some sudden conversion to a revolutionary concept of Indians' rights to ancestral lands. He is only following, he says, the instructions of U.S. District Court Judge Edward T. Gignoux, who ruled that the federal government had to assert the tribal claims.

"The court said we are the trustee for the Indian tribes, so we have to be an advocate," Taft said in a recent interview.

Things do get ticklish, however. "Muskie [Sen. Edward Muskie of Maine] has asked us, "How can you agree on one thing one day and then on another the next?" But we're have to make all the arguable claims we can in he Indians' behalf."

But Taft has gone beyond the narrowest legal avenue to propose a negotiated settlement. It was he who suggested an impartial mediator, appointed by the White House, and he has insisted repeatedly tht Congress has to get involved. History reminds him that Congress can extinguish legal Indian claims with a simple statute - and has often done so. In other words, Congress could leave the Maine tribes with a marvelous legal argument - and no land or compensation.

For many lawyers, the Indians claims are staggering. Originally they sought about 12.5 million acres, including most of the heavily populated coastland and affecting the property of up to 350,000 people. In all, it has been loosely suggested, something like $25 billion in land and compensation was at stake. Their contention, angrily resisted by the state of Maine, is that these aboriginal lands were illegally taken without congressional approval in the late 18th century.

Taft and the Indians mutually agreed to scale down the land claims in order, it seems, to minimize congressional wrath and forestall a reaction that would extinguish all claims. Justice now will sue only for about 5 million acres. Eliminated are the populous coastal areas where the litigation could be devasting. The initial suit will be against a limited number of major landowners above watersheds far removed from the coast. It is widely believed that one of the major paper companies holding vast acreage in Maine's interior will be the first target.

"It was in the interest of the tribes to diminish the economic and social impact of their claim," Taft said. "The tribes have to be concerned tht if the impact is too great. Congress will impose its own settlement. It wasn't in their interest to bring the state to its knees."

The Indians' attorneys credit Taft and another Republican, former Department Interior Solicitor H. Gregory Austin, with turning around the government's position and polishing the suit, all against considerable pressure from Maine's governor, James Longley, and its congressional delegation. In January, Austin composed what was called a "preliminary litigation report" which in effect declared that the federal government had to go to court on behalf of almost everything the Indians had sought.

"The views of Austin and Taft were the real changes at the top," said Stuart P. Ross, an attorney for the tribes. "They had no preconceptions and they simply analyzed it as lawyers. They were not overwhelmed - as some had been - by the concept and the enormity of a suit involving billions of dollars and thousands of land titles."

Taft assembled a team of lawyers who spent days interviewing experts and searching archives for assurance that the Penobscots and Passamaquoddies had really occupied the claimed lands in the sense understood in Indian law. They called in anthropogists and ethno-historians to prove that the territories and that other tribes had recognized that dominion.

They finally agreed - after much discussion of hunting, fishing, and berry-picking rights - that the tribes had occupied vast territories in two watersheds at least.