Caffeine and related compounds are potent, natural insecticides that help plants ward off damaging pests, a Boston researcher has found. The findings could lead to a new way to fight insects.

In a report published Friday in the journal Science, Dr. James A. Nathanson said the natural function of caffeine in plants has been a mystery, even though it has been used for centuries as a stimulant by millions of people.

''Despite all of the research that has been done on caffeine in mammals, no one to my knowledge has ever determined why it is present in plants,'' said Dr. Nathanson, a neurologist at Harvard Medical School and Massachusetts General Hospital.

''Over time, plants have developed certain defenses to protect themselves against insects, and we suspected that caffeine might have been present for that purpose - as a natural insecticide,'' he said. Disturbed Insect Behavior