President Carter and Sen. Edward M. Kennedy (D-Mass.), potentially Carter's most formidable 1980 presidential primary rival, engaged in an unusually sharp political exchange yesterday over the merits of the administration's proposed "windfall profits" tax on the oil industry.

In a New York speech yesterday, Kennedy accused the administration of being "intimidated" by oil company lobbyists into proposing "a token windfall profits tax that is no more than a fig leaf over the vast new profts the industry will reap" from Carter's decision to decontrol oil prices.

"That is just a lot of baloney," the president replied a few hours later during a nationally televised news conference.

"I really can't believe that Sen. Kennedy said this unless the phrases were taken out of context . . .," the president said when asked about Kennedy's remarks.

The fact, Carter was well aware of Kennedy's speech by the time of the news conference, having been shown news reports of it earlier by press secretary Jody Powell. One presidential aide said he noted a "tone of irony" in Carter's expression of "surprise."

The long-distance exchange was the sharpest public dispute to date between Carter and Kennedy, who continues to lead the president in public opinion polls of Democratic voters.

The Massachusetts senator has said repeatedly, as he did yesterday in his appearance before the American Society of Newspaper Editors, that he is not a presidential candidate and that he expects to work for

This has rankled presidential advisers, who yesterday urged a counter-attack after Kennedy directly attacked the "windfall profits" tax-a proposal the White House has sought to use to revive Carter's image as a populist, unafraid of even the most powerful "special interests."

"We were not looking for a fight," said one presidential aide. "But as long as he [Kennedy] is in the posture of not running-but doing everything necessary to run-that is not a oneway street. Teddy Kennedy can't have a free ride . . . Why should we let him have a free ride?"

Defending the tax proposal, the president noted that under existing law price controls on domestic oil would end in October 1981.

"I am complying with an existing law," he said. "In order to minimize the impact of decontrol, we are carefully and slowly phasing out controls over roughly a 28-month period. I have made a proposal to the Congress which, in my judgment, is eminently fair. It lets the oil companies keep 29 cents out of every dollar of increased revenue which they drive from decontrol."

Carter then repeated a statement made earlier in the news conference, inviting Congress to strengthen the "windfall profits" proposal.

"If the Congress, including Sen. Kennedy, wants to tighten up on that windfall profits tax with their proposals, [if] I consider [them] to be fair I will gladly support such more stringent windfall tax proposals."

The president added:

"I will not support any more in the Congress to make the windfall tax more lenient on the oil companies . . . And I am always amenable to proposals made by Sen. Kennedy or anybody else to make the laws fairer or more stringent if the Congress thinks they should be made more stringent."

Kennedy has long opposed decontrol of oil prices. But one White House official said what particularly irritated Carter about Kennedy's New York speech was the suggestion that the administration had "caved in" to the oil companies.

"I think the president found that personally offensive," the aide said.

In this New York appearance, Kennedy appealed for stronger national leadership and was later asked if he chose that theme because he could no longer support Carter's policies. He replied that he would continue to support the White House where he agrees-for example, on an arms control agreement with the Soviet Union, in the Middle East and on the normalization of relations with China-and oppose it on other issues such as national health insurance and energy polices.

The president opened his news conference with an appeal involving energy policy. He said that it in "imperative" for the House Commerce Committee to reverse its earlier decision and vote today to approve the administration's standby gasoline rationing plan.

"It is a simple matter of common sense for us to do everything we possibly can to reduce our vulnerability to another oil embargo or a Middle East crisis or an interruption in our own domestic oil supplies," he said.

"We do not face any of these contingencies now, but we must be prepared for the worst. "We must make certain that our gasoline can be distributed promptly and fairly in case of an emergency. No one likes gasoline rationing and we will avoid it if it is possible. But I will not hide from my responsibility to the nation, and Congress likewise needs to shoulder its share of the responsibility."

The House committee rejected the standby gas rationing plan, 22 to 20, last week.However, Rep. John Dingell (D-Mich.), the subcommittee chairman handling the legislation, said yesterday he believes that decision will be reversed today.

Since last week's rejection, committee members have received a letter from the White House promiging that, if rationing becomes necessary, extra gasoline will be allocated to rural states where people must drive long distances to work.

Hours before Carter issued his appeal on the rationing issue, his energy plan received another setback when the Senate Energy Committee rejected a provision that would have given the president power to order weekend closings of gas stations.

Carter appeared exceptionally relaxed and confident during the news conference. At one point, he lightly brushed aside a question about a recent magazine article critcizing him by James Fallows, his former chief speechwriter.

"Jim Fallows and I agree on most things," the president said. "His assessment of my character and performance is one of those things on which we don't agree, and this is unfortunate but understandable. He left White House employment with a very good spirit of friendship between me and him and with no insinuation that there were things about which he was disappointed."

Asked about Fallows' assertion that Carter personally approved use of the White House tennis court although the president had denied this to a television interviewer, Carter said he never "personally monitored" use of the court but did have his secretary clear requests "so that more than one person would not want to use the same tennis court simultaneously, unless they were either on opposite sides of the nest or engaged in a doubles contest."

On other topics, Carter:

Said that as of last week the administration was certain that only one company-Sears-was not complying with the voluntary price guideline and that it later came into compliance after an appeal from him. "I do not know at this point of any company where we can prove that they are out of compliance because they modify their prices, or convince us that they indeed are meeting the guidelines."

Said he does "not want to get involved" in wage negotiations but will continue to make the administration's anti-inflation position known when major wage settlements near completion.

The president also contended that a number of factors contributing to higher prices for such basic needs as food and fuel are out of the government's control but that there is "some hope for the future afterseveral months" that these prices will begin to level off. CAPTION: Picture, President Carter: Sen. Kennedy's criticism of proposed oil industry tax "is just a lot of baloney." By Frank Johnston-The Washington Post