The body's desperate attempt to regulate the amount of calcium in the body may explain why kidney patients sometimes suffer mental deterioration.

Doctors at the University of California at San Francisco have for the first time demonstrated that excessive secretions of the hormone PTH by the parathyroid gland seem to cause a calcium buildup in brain cells,causing mental confusion or coma and forcing patients to begin dialysis.

Removal of the parathyroid gland, located in the throat, may be a way of preventing the problem, Dr. Cosmo Fraser told a recent meeting of the American Society of Nephrology.

As kidneys begin to fail, various poisons enter the body, a condition called uremia. One key change is that the blood level of calcium drops. This confuses the body, so the parathyroid gland wildly produces PTH, which is responsible for processing calcium, in an attempt to compensate. Fraser's experiments on rats have shown that the excess PTH actually triggers the mental decline.

In some of the rats, the parathyroid glands were removed.

''Clinically, the animals with uremia were very ill,'' Fraser said, ''but those without their prathyroid glands looked better and lived longer.''

It remains to be seen whether such an approach would help humans. ''Our goal is to keep patients functioning mentally so they can avoid dialysis as long as possible and maintain a better life style even on dialysis," Fraser said.