The rare feat of provoking angry attacks from Sen. Edward Kennedy (D-Mass.) and Speaker Thomas P. O'Neill in one day was not really the apotheosis of Jimmy Carter's incompetent presidency but instead an attempted return toward the politics that propelled him into the White House.

President Carter was fully aware of the consequences of firing O'Neill's pal from the General Services Administration and rejecting Kennedy's national health-insurance program. He decided that now was the time to present his own profile of courage: a president with a mind and principles of his own.

To some veterans of his 1976 campaign, the double jeopardy of alienating Kennedy and O'Neill was a watershed for Carter. After 18 months of trying to appease conflicting constituencies in the Democratic coalition, the president was back to a broad-based appeal transcending those special interests. After so many "comprehensive" programs (tax reform, welfare reform, consumer protection) were dispatched to a deep grave on Capitol Hill while placating liberal pressure groups, the president this time marched to his old drummer.

The problem at the scandal-torn GSA stemmed from incompatibility between administrator Jay Solomon, who was appointed by Carter, and his career bureaucrat deputy, James Griffin. "We had to fire one of them," a presidential aide told us. "Were we going to fire Carter's man or O'Neill's man?" At issue was whether Carter is really president.

Health insurance posed tougher questions. The expensive Kennedy plan, supreme legislative goal of organized labor, has been under intense fire by the president's economic advisers. Its huge cost would make Carter's anti-inflation fight no longer credible. In private meetings, Treasury Secretary W. Michael Blumenthal put down proposed cost-control schemes as laughable.

But White House handwringers warned of a vengeful Kennedy, backed by labor, gaining retribution by running against Carter in 1980. In response, advocates of the old Carterism replied that a dramatic show of independence is just what the president needs.

Once the administration accepted the principle of the patient's paying part of his medical bill even under national health insurance, support from the AFL-CIO's George Meany and the United Auto Workers' Douglas Fraser was lost. Still, there was hope until the end that Kennedy could be brought along.

That is why the president did not unveil his plan as a preemptive strike, but instead courted Kennedy with a private briefing July 28. Angered, the senator would not accept anything less than a comprehensive bill, informing Carter he would publicly disavow the program before it was announced.

The quiet Carter-Kennedy confrontation followed that morning's noisy breakfast, where O'Neill bellowed to the President he was "breaking diplomatic relations" with the White House. It was interpreted throughout this city that the inept Carter presidency had managed to alienate the two most powerful men on Capitol Hill in a single morning.

The speaker was still breathing fire after the weekend. Kennedy was characteristically less ferocious, but had inspired dire forecasts within Carter's own administration. One assistant secretary told us the president's course will "polarize the party" and conceivably cost him the 1980 presidential nomination. What, then, should the president do? "Do what Teddy wanted," the Carter appointee replied.

However, that official, like many others in the administration and the White House itself, probably would desert the president in a Carter-Kennedy show-down. "We've got to figure out what side of the issue to be on," commented one such aide who perceives only two sides: for health care or against it. He still hoped the president would end up "for" - that is, backing the "comprehensive" Kennedy bill.

But the corporal's guard of Carter loyalists is delighted with the president's decisions that have angered Ted Kennedy, George Meany and Doug Fraser (with O'Neill as an appetizer). "My own guess is that if Kennedy wants to run he'll run, and how good Carter's health insurance is won't have anything to do with it," one loyalist said.

He feels the president's backing of a health plan that makes it advantageous for the patient to find the cheapest care suits both the national mood and the stark limits of government resources. Indeed, there seems to be long-range political yield from a program that self-destructs if it proves inefficient.

There is quiet satisfaction over the provocation of Teddy and Tip among aides who regard the president's aborted crusade against expensive federal water projects as no blunder but the path on which he should have stayed. Far from continuing the Carter follies, this may be the beginning of - or a return to - wisdom.