Soviet Foreign Minister Andrei Gromyko, on his first visit to a European country that has installed NATO cruise missiles, today urged the Italian government to break with its U.S. ally and oppose the "star wars" defense proposed by President Reagan.

The Soviet official's comments came during a lunch after a three-hour meeting with Italian Foreign Minister Giulio Andreotti. They included warnings that because of the "star wars" proposal, scheduled U.S.-Soviet arms talks next month would probably be difficult.

Gromyko, who later met for two hours with Italy's Socialist Prime Minister Bettino Craxi, said the Soviet Union would not "give in to fatal pessimism" but neither was he optimistic about the talks.

"Personalities on the highest level" in the United States are suggesting that "the colossal programs of accumulating arms will continue to be followed," Gromyko said, accusing the U.S. designers of the strategic defense initiative of pursuing "a mirage of military superiority."

According to the Italian news agency ANSA, Gromyko was even blunter in private with Andreotti, saying withdrawal of the space-based defense plan was "absolutely essential" for the success of the talks."

During the state luncheon, Gromyko said that if Italy were to oppose the plan it could help the talks. "We do not hide that we would like to see also Italy among the countries that have raised their voices against . . . putting weapons in space," he said

Italy, one of the first NATO countries to accept cruise missiles, has expressed concern about nuclear arms in space but supports the United States' right to carry on a research program.

At today's luncheon, Andreotti said that a major objective for the superpowers would be "to arrive at political agreements capable of 'bridling' the results of that research and to guarantee that they are maintained under the control of the political authorities" of the United States and the Soviet Union.

The Italian foreign minister also said it was important to continue to honor the 1972 treaty that limits superpower antiballistic missile defense systems to a single site.