ATLANTA (AP) _ An outbreak of diarrhea and gastrointestinal illness in New Mexico last year may stem in part from drinking and swimming in untreated water, federal health officials reported Thursday.

If so, it would be the first time that such waters have been found to be sources of cryptosporidiosis, said the national Centers for Disease Control.

Between July 1 and Oct. 1, 1986, 78 lab-confirmed cases of the parasitic illness, which causes diarrhea, nausea, and cramps, were reported to New Mexico health officials, the CDC said.

Fifty-eight patients were from Albuquerque or surrounding Bernalillo County. Patients ranged in age from 4 months to 44 years, with a median age of 3 years. Seventeen were under 10 years old.

Dr. Maggi Nichols, an epidemiologist with the New Mexico Health and Environment Department, which conducted the studies, said the discovery meant more precautions should be taken when drinking fresh stream or lake water.

''The main group we're trying to reach are hikers and backpackers,'' she said, adding that chlorine or iodine-based water purification tablets may not kill the parasite.

''For people who go backpacking, outdoors people, if they have to drink the water that is available, they should bring it to a boil and that should be effective,'' she said. A small filter is a fair alternative, she added.

An investigation turned up two possible risk factors - drinking untreated surface water, in streams and the like, and attendance at a day-care center where other children were ill, the Atlanta-based CDC reported.

There also ''may have been an increased risk of illness among those who had swum in surface water,'' the agency said in its weekly report.

Patients' exposure to surface water occurred in New Mexico, southern Colorado and Mexico, the agency said.

Previous outbreaks of cryptosporidiosis have occurred among animal handlers and in day-care centers, but ''surface water has not been previously demonstrated as a source of infection'' with the parasite, the CDC said. ''This study demonstrates that it may be.''

A major water-borne outbreak of gastrointestinal illness in west Georgia last January has been blamed on cryptosporidiosis, from a river which served as a municipal water supply. The CDC has not officially ruled on that outbreak.

The CDC's report on the New Mexico case said that the parasite, which has been isolated from a number of animals, might have gotten into untreated water either directly, through animal waste, or indirectly, through rainfall washing waste into water sources.