Rajiv Gandhi, leader of a country where the chief health problems stem from poor sanitation, went to the National Academy of Sciences yesterday for a briefing on technologies that the moguls of American science thought might interest him.

They showed him a robot that performs brain surgery.

The Indian prime minister smiled in bemusement as the machine's little computer-guided tubular arms twirled about and its two fingers picked up a drill and bored a hole in a store-window dummy's head.

After the robot put down the drill and simulated taking a biopsy of a brain tumor, Gandhi politely explained that it was all very wonderful but that there were some technologies in American society "that do not find a slot in our country."

The briefing, an unusual event in the itinerary of a visiting head of state, was arranged by George A. Keyworth, President Reagan's science adviser, and Frank Press, president of the academy.

Gandhi, trained as a mechanical engineer and a former airline pilot, has begun several programs to turn more of India's prowess in basic science -- well known in the international scientific community -- into practical improvements in people's lives.

Indian universities graduate more PhDs each year than do those of any other country, and India's scientific establishment is the third-largest in the world, after the United States' and the Soviet Union's. However relatively few of these technically proficient people devote themselves to solving India's practical problems.

The robot, therefore, did not captivate Gandhi. He showed more interest in glowing accounts of how genetic engineering could provide Indian agriculture with drought-tolerant crops and Indian medicine with bioengineered artificial vaccines against leprosy, cholera, typhoid, malaria and other diseases.

"Are there any dangers?" Gandhi asked of Howard Schneiderman, an official of Monsanto Corp., which does research in this area.

Schneiderman, apparently not expecting skepticism, fumbled a bit and replied, "I find it hard to believe that I could design a millet plant that would devour India."

The prime minister was similarly skeptical about a presentation by Ian Ross, president of AT&T Bell Laboratories, on the marvels to come with advances in computer technology. Ross noted, however, that it could cost around $100 million to develop a new kind of chip or related technology.

"Can we afford it?" Gandhi asked.

The most detailed conversation followed a presentation on biomass conversion, a technology India has been developing for many years as it seeks to recapture the energy content of vast quantities of cow dung, wheat stalks, rice hulls and other common waste products of an agrarian society. In closed vats bacteria attack such materials, breaking them down and releasing methane, a flammable gas.

Donald Klass of the Institute of Gas Technology told Gandhi how many cattle India had and where the country got its energy. India's defense minister, P.V. Narisimha Rao, asked whether the Americans had yet found a simple way to reseparate methane from carbon dioxide, which is also produced but is useless as fuel and costly to store.

Klass said no.

At the briefing's start, Keyworth told Gandhi, "We are delighted to present to you four leaders of American science and technology and one robot."

All of the scientists were from private industry. The robot was too. According to Joseph Engelberger of Westinghouse Electric Corp., it has operated on a patient at Long Beach Memorial Hospital in California, a 52-year-old man. He said the device is guided by data from a CAT scan. The robot selects the best place to enter the skull, drills through the bone and removes a piece of tumor for biopsy.

Gandhi told the scientists that India was interested in developing its technology but the choices would have to be appropriate to India's needs. He cited India's gains under the so-called Green Revolution of high-yielding crop varieties specifically adapted to India's climates, soils and peoples.

Once a land of famine, India now produces agricultural surpluses and, Gandhi said, had even donated 100,000 tons of wheat to famine-stricken Africans.

"Our people now have an appetite and a need for newer technologies," Gandhi said. "We're looking to you to help us develop technologies suitable to our problems."