Prime Minister Margaret Thatcher signaled major changes in her Cabinet today in the aftermath of her overwhelming mandate for a second term as the opposition Labor Party surveyed its shattering defeat and the centrist Alliance its considerably weakened parliamentary position.

The final tally was 397 seats for the Conservatives; 209 seats for Labor; 23 seats for the Alliance of Liberals and Social Democrats, and 21 seats for the small nationalist parties of Scotland, Wales and Northern Ireland. These results give the Conservatives almost triple the majority they had in the last Parliament.

In her first postelection interviews, Thatcher, in a buoyant mood, removed any doubt that some senior ministers would be replaced in the incoming Cabinet. "I feel it's time to have a new look," she said. The changes, probably including a different foreign secretary and finance minister, are expected this weekend. Thatcher joked about the impending moves saying, "I am not a good butcher, but I have had to learn to carve the joint."

In Washington, President Reagan telephoned Thatcher Friday morning with his congratulations and said he looked forward to "continuing the close relationship between the United States and Great Britain," White House spokesman Larry Speakes said.

Labor, which only a decade ago was considered by many experts as Britain's "natural party of government," was plainly shattered by the scale of its defeat, an outcome that final polls and voting analyses showed resulted from popular revulsion with the party's policies and leadership.

Throughout the day pressure mounted on Labor's dispirited leader, Michael Foot, to make known the timing of what is now considered his certain departure. He refused any comment as he came and went from party headquarters as did deputy leader Denis Healey, whose resignation is also anticipated.

Labor lost 30 percent of its 1979 supporters, according to an election-eve and voting-day Gallup Poll taken for the British Broadcasting Corp., with three of every four defectors going to the Alliance. Both the BBC and Robert Worcester, the private pollster who came closest to predicting the election outcome, blamed the extremism of Labor for chasing away so many of its traditional supporters.

"It was the incredibility of Labor policies and the incapability of Labor leadership that largely determined this election," said Worcester, who polls for the Labor Party among other clients.

In the Gallup study, one-fifth of all voters, one-fourth of the Labor defectors and one-third of the Alliance recruits cited Labor's extremism as a major reason for their vote.

Foot himself was clearly a drag on the party, rated by only 13 percent of the voters in the BBC poll as the best choice for prime minister as compared with Thatcher with 46 percent and Liberal leader David Steel with 35 percent. Roy Jenkins, head of the Social Democrats, was the choice of 6 percent.

The eagerness among senior Labor figures for Foot to step down is tempered only by concern over avoiding a bruising battle to succeed him. Internal disputes over the party's leadership since Labor's loss at the last general election in 1979 added to public disenchantment, Labor strategists concede.

How best to avoid renewing such struggles may well decide the timing of Foot's replacement. Among the candidates are Roy Hattersley and Peter Shore, who have considerable experience as ministers in past Labor governments, and Neil Kinnock, 41, who has been Labor's spokesman on education affairs.

Kinnock, a Welshman with a rhetorical flair, would give the party a more dynamic front man, but Hattersley and Shore have seniority. Tony Benn, the long-serving member of Parliament who had renounced a hereditary title and became the symbol to many British voters of Labor's leftward tilt in recent years, lost his reelection bid.

For the first time since the early decades of this century, Britain's electorate is clearly split three ways, based on the popular vote totals in this election.

One paradox of the vote is that the Conservatives gained a much larger majority in Parliament even though their share of the popular vote dropped almost 2 percent from 1979. The nine-point drop for Labor and the inability of the Alliance to convert the nearly 12-point gain over the 1979 Liberal base into more than a strong second-place finish in most districts opened a gap through which Thatcher rode to victory.

The Alliance's position in Parliament will be weakened by the defeat of 22 Social Democrats who were defectors from Labor (plus one who defected from the Conservatives) in the period after the Social Democratic Party was established in 1981.

Another paradox is that the Liberals did better than they did last time, but the Social Democrats failed to hold up their end of the pact in terms of gaining seats toward the goal of providing a middle-of-the-road parliamentary alternative to the two larger parties.

In the days ahead, Liberal leader David Steel and the remaining Social Democratic leaders, Roy Jenkins and David Owen, will have to fashion a new relationship. With only six members in the new Parliament, the Social Democrats will be a minor factor, but Owen and Jenkins are figures of considerable standing. At the momemt, one analyst observed, the Social Democrats are "all head and no body."

The Alliance proved, however, that it could mount a nationwide campaign capable of winning a quarter of the popular vote--only a few percentage points below Labor's total. If this is to be translated into a movement that can eventually take power, the political organization must be maintained even though its voice in the House of Commons will be relatively small.

It was widely agreed today that there was no chance of either Conservatives or Labor agreeing to consider electoral reforms that would make seats in Parliament dependent on popular vote totals rather than on who wins each seat.

Many European countries have a system of proportional representation, where minority parties get representation in the legislature in proportion to their popular vote. In Britain, as in the United States, legislative seats are filled by the winner in each constituency.

Thatcher said her victory showed that the country wanted strong leadership. She denied that her landslide win would lead her to more "extreme" right-wing policies as some critics, including voices within her own party, have said was a danger. "I have not been extreme for the last four years," Thatcher asserted. "I am not now an extreme person."

She said her revamped Cabinet would reflect a cross section of Conservative Party views. It was believed, however, that Foreign Secretary Francis Pym, who was rebuked publicly by Thatcher for expressing concern about a landslide, would be replaced, possibly by Chancellor of the Exchequer Geoffrey Howe.

Leading candidates for Howe's crucial financial portfolio are Nigel Lawson, the present energy secretary, and Patrick Jenkin, the industry minister. Another likely change will be to move William Whitelaw from the important home affairs ministry. Whitelaw, like Pym, represents the Tories' more liberal wing, but since both are distinguished politicians, Thatcher may offer them other, lesser Cabinet jobs.

In Folkestone, Conservative Michael Howard won his race as did Tory Robert Rhodes James in Cambridge.

In Northern Ireland results, Gerry Adams of Sinn Fein, the political wing of the outlawed Irish Republican Army, defeated Gerry Fitt and Joe Hendron, both outspoken opponents of violence in the province and whose combined vote total exceeded Adams'. Sinn Fein refuses to recognize British authority in Ulster, and Adams is not expected to take his parliamentary seat.

The final Gallup and Worcester polls drew a picture of an electorate in which negative emotions were uppermost. Gallup found that among voters for each party, dislike of the opposition was rated a stronger motive than support for their own team. Worcester reported that even though Thatcher was rated better than her rivals for prime minister, she repelled more voters from backing the Tories than she attracted.

For Republicans in the United States studying the Thatcher campaign for clues to 1984, the lesson has to be that a weak and divided opposition is a bigger boon than anything conservative policies by themselves can guarantee.

Still, there were important positive elements in the Thatcher victory that President Reagan may seek to emulate. Thatcher held Labor to a tiny three-point lead among those who had experienced the loss of a job themselves or in their family in the past four years. She piled up an absolute majority against all parties among those untouched by Britain's worst postwar recession, according to Gallup.

Tory policies were rated the best overall by the voters, with particularly striking advantages on maintaining a strong defense and curbing inflation, two of the principal items in Reagan's list of claimed accomplishments.

There were also endorsements in the Gallup findings of some fundamental attitudes that Thatcher, like Reagan, projects. Majorities of 56 percent to 61 percent said that in dealing with opponents, a leader should stick to his or her own beliefs, rather than compromise; that in difficult economic times, government should be tough, rather than caring; and that in the battle against unemployment, private business has a bigger role to play than government.

On the other hand, British voters in the survey said by a 4-to-1 margin that they give maintenance of public services priority over new tax cuts.

There was good news for Reagan, also, in the election-day poll on defense issues. A 55-percent majority favored the scheduled deployment of American cruise missiles in Britain and 80 percent opposed unilateral scrapping of Britain's Polaris missiles.