In an effort to revive his flagging bid for the Democratic presidential nomination, Sen. Edward M. Kennedy yesterday reverted to the formulas of traditional liberalism which have fueled his political career but which were subordinated, if not forgotten, in the first three months of his challenge to President Carter.

It was far from certain whether Kennedy's left-turn of foreign and domestic policy would rally enough support to overcome the high-flying president. But his aides and friends rejoiced last night in the belief that Kennedy had at least reclaimed a position as the spokesman for Democratic liberals, from which he can function in the Senate for the next four years and perhaps as a presidential candidate again in 1984.

Kennedy yesterday came out against the draft, the shah, the oil companies and using the Soviet invasion of Afghanistan to justify a new round in the arms race. He came out for gasoline rationing, wage and price controls and a compromise with the Iranian regime to gain release of the hostages.

In redefining his case against the renomination of the incumbent, he explicitly identified himself with the cause and views of Sen. George S. McGovern, the 1972 nominee and symbol of liberalism in foerign and economic policy.

Unsurprisingly, Kennedy's address was cheered by McGovern and by Rep. Morris K. Udall, of Arizona, who carried the liberal banner longest in the 1976 fight against Carter.

Unsurprisingly, too, it was labeled "irresponsible" by a nameless spokesman for the Carter-Mondale campaign.

Sen. Henry M. Jackson (D-Wash.), an exponent of military power, called it "a strong speech," but noted his disagreement with Kennedy's opposition to resumption of draft-registration or a peacetime draft.

But a Democratic senator who is publicly neutral in this fight but personally close to Kennedy gave a more significant comment when he said: "I think Ted is right in provoking a basic debate on Carter's policies, and not just because he's running against him. But I doubt that he [Kennedy] is going to help himself a lot by staking out the stands he's taken. His instincts are right, but the time may be wrong for him."

From the opposition party, John P. Sears, Ronald Reagan's campaign manager, said he thought Kennedy wise to "move to the left of Carter domestically, but I would think internationally, he'd want to be to the right of him. That way he could try to strip him from both sides."

Kennedy consulted with some Democrats who urged exactly that course, but in the end, according to his press secretary, Tom Southwick, he rejected the counsel to take a hard-line military-diplomatic stance, "and that ended the discussion."

When it was time to put the new policy emphasis into speech form, Kennedy turned to people who reflected his own historic liberalism and dovishness.

Peter Edelman, head of Kennedy's domestic issues staff and a veteran of the Robert F. Kennedy campaign, said the principal authors of the Georgetown University address were Carey Parker, Kennedy's longtime Senate aide, and Robert Shrum, a former McGovern speechwriter and liberal activist.

Longtime Kennedy family intimate Arthur Schlesinger Jr. also contributed to the framing of the speech, according to a campaign official for Kennedy.

But Southwick said "the essence of the speech was his and his alone, as much as any speech he's ever given."

That likelihood was signaled in the comment Kennedy made Sunday to Mike Barnicle, a Boston Globe columnist and close friend. Barnice quoted Kennedy as saying, "When my grandchildren ask me 20 years from now why I ran for president in 1980, I'll be able to tell them why. I'll be able to tell them about the things I talked about and the things I stood for."

That was not the case in many of his earlier speeches. Kennedy talked about such safe subjects as leadership and the national spirit. He camouflaged his traditional economic views by saying "we do not ask to bring back the New Deal or restore the New Frontier to life."

When he drew a storm criticism early in the campaign by suggesting that Carter's decision to admit the deposed shah of Iran to the United States for medical treatment had triggered the hostage situation, he persisted for a few days, then subsidued into silence on the susbject.

Yesterday, he decided, as one aide said, to "let it all hang out," and by doing so, he immensely cheered his immediate entourage of liberal-minded staff aides and their counterparts in Kennedy campaign around the country.

"I'm not sure what the effect will be up here," said Janet Mills, a Kennedy supporter in Maine, "but I think he's right to come out and take a stand on the issues. We need a debate on these questions, instead of just begging people to come out and vote for this one or that one."

But Kennedy's decision to sharpen his policy differences with Carter is just as much a "political decision as Carter's refusal to meet his challengers in open debate. Carter has taken the classic tactic of the front-runner, and Kennedy's decision reflects the risk-taking that is forced a challenger who finds himself a distinct underdog.

The latest polls show Kennedy trailing in the Feb. 10 Maine caucuses and the Feb. 26 New Hampshire primary -- two tests he has said he must win in order to survive politically.

As Udall said yesterday in applauding the Kennedy speech, "his problem has been to provide a credible set of counter-policies that would justify putting down an incumbent president. He's been 'ad-hocing' it all these weeks, and it hasn't worked, so he's wise to make the speech. I'm not sure what effect it will have on the campaign, but it will end the rumors that he's panicking and pullin out."

McGovern, who, like Udall, has endorsed Kennedy, said he thought it "a good speech," but he conceded that "the fact the president is riding a popularity crest currently means Ted will take some heat."

"But he had to do it to get some credibility for his effort," McGovern said. "There's no point changing leaders if you're going to follow the same course."

The same mixture of support and concern came from Rep. Paul Simon, the Kennedy leader in Illinois. Simon said, "A tough speech was what we need -- and I hope it's what the public wants. The rationing part will not go well in my district, but the wage and price controls will sell. It is not a speech whose individual points are going to end up being approved in southern Illinois or New Hampshire, but the overall image is of someone who's willing to come to grips with the issues, instead of just waffling around. And that is what Kennedy has to sell."

The "sell" began yesterday, in a television version of the speech beamed into New Hampshire and Maine, and it will continue for the next four weeks until the New England voters have rendered their verdict.

Kennedy himself appeared to anticipate that the decision may not be favorable, by quoting the keynote line from the December 1978 speech he delivered to the democratic mini-convention in Memphis -- a speech whose rapturous reception from the liberal activist delagates really triggered his challenge to Carter.

"As I said a year ago," he said, "sometimes a party must sail against the wind."

As a politician, that is what Kennedy has done well, and in his moment of extremity, that is what he is doing again.