The cause of President Carter's distress during a marathon near Camp David yesterday may well have been in his head, rather than in his legs.

In fact, Sen. Edward M. Kennedy, a Soviet brigade in Cuba, the economy and aide Hamilton Jordan's legal difficulties may have had as much to do with Carter's physical problems as the steepness of the mountain racecourse.

Although the White House yesterday refused to release any explanation of why Carter, who has been jogging for more than six months, was unable to complete the race, several highly respected medical experts said psychological stress can sap the strength and stamina of someone who is otherwise physically fit.

Such a physical collapse "certainly could" be psychological stress, said Dr. Theodore Cole, chairman of the department of physical medicine and rehabilitation at the University of Michigan School of Medicine.

Explaining that he has not examined Carter, and was only engaging in speculation, Cole said mental stress could have affected the president's physical performance "by putting a strain on his body reserves prior to the race; perhaps he was exhausted."

Cole said that the symptoms -- groaning, rubbery legs, loss of color and glazed eyes -- witnessed by Washington Post reporter Colman McCarthy, who was running beside Carter when the president collapsed, could suggest he wasn't getting enough oxygen to the brain.

"For a trained runner," said Cole, "it would be uncommon to drop out that soon. If he had those kinds of symptoms, then there are a whole host of possibilities."

"The most serious" of those possibilities "is a weakness in his cardiovascular system, possibly in the heart, possibly the cerebral blood flow."

On the other hand, said Cole and other physicians, "an early stage of a virus could cause these symptoms."

Dr. Vernon B. Mountcastle, chairman of the division of physiology at Johns Hopkins University School of Medicine, said, "Every runner has had this happen to him. I've experienced it myself. If one tries to run farther than one is used to, or up and down hills," the system may be overtaxed.

Dr. Myron L. Weisfeldt, chairman of the division of cardiology at Hopkins, said there are "a lot of reflex factors . . . that can lead to a sudden feeling of fatigue, or real fatigue."

A problem like an upset stomach, totally unrelated to the exercise," could have caused "some sort of reflex phenomenon like pooling of blood in the abdomen," said Weisfeldt. Such blood pooling would result in less blood being pumped to the brain, and a feeling of faintness, or actual fainting, he said.

Carter's symptoms could also have been caused by a drop in blood pressure, set off by something as simple as becoming overheated, said the cardiologist.

When the body overheats, blood rushes to the surface of the skin where it can be cooled off. Because so much blood is being sent to the peripheral areas of the body, a person can become faint from lack of blood -- and hence oxygen -- in the brain.

Weisfeldt also said psychological stress could cause a similar physical reaction. "On a reflex basis, certainly, under stress peoples' bodies react by pooling blood, dilating the arteries."

There are a whole series of heart problems which, short of a heart attack, could cause symptoms such as those Carter experienced, said Weisfeldt.

But the symptoms alone, he said, do "not indicate any serious problem."