Israeli Prime Minister Shimon Peres met privately today with Pope John Paul II, but the 40-minute meeting failed to resolve outstanding differences on the Middle East to which the Vatican attributes its continued failure to establish diplomatic relations with the Jewish state.

The meeting, the first of its kind since 1973 when Israeli premier Golda Meir had a tense meeting with Pope Paul VI, was described by the Vatican as "cordial" and the two men also exchanged gifts.

Diplomatic sources said Israeli anger over a papal audience granted Palestine Liberation Organization Chairman Yasser Arafat in September 1982 had eased. However, Peres said after the meeting in the papal library that he had not formally invited John Paul to visit Israel, although he said the pontiff would be a "welcome guest" should he decide to visit the area.

Peres, who arrived in Italy Monday for a three-day state visit, also said he had not directly discussed the question of diplomatic relations with the pope. But there was speculation that the subject, known to rankle the Israelis, might have been raised in an earlier 45-minute meeting with the Vatican secretary of state, Cardinal Agostino Casaroli.

A well-informed diplomatic source said the atmosphere of the talks was warm but asked if diplomatic relations were now a possibility replied, "not tomorrow and not even the day after tomorrow."

The Vatican currently has relations with 111 countries. For the past 16 years there have been regular contacts in Rome and Tel Aviv between Israeli diplomats and Vatican officials but the Holy See, concerned about the status of Jerusalem, holy sites within Israel and the Palestinians, many of whom are Christian, has never wanted to formalize those relations.

In 1964, Pope Paul VI visited Israel on a trip to the Holy Land but managed to spend an entire day in the country and be formally greeted by its president without actually ever pronouncing the name Israel.

Following the meeting today, the Israeli prime minister told reporters he had assured John Paul that his government would respect the rights of all religions with shrines in the city but that Jerusalem would remain the Israeli capital.

A Vatican spokesman said afterward that the pope stood by his apostolic letter issued on April 19, 1984, Good Friday, in which he called for "a special internationally guaranteed statute" for Jerusalem.

Following his arrival here Monday, Peres met with Italy's Socialist Prime Minister Bettino Craxi to discuss the Middle East situation and, in particular, the recent agreement between King Hussein of Jordan and Yasser Arafat for a joint negotiating strategy. He reportedly told Craxi that, in the Israeli view, the Hussein-Arafat agreement was an inadequate basis for new peace talks.

The Italian government, which holds the presidency of the Common Market for the next six months, has promised to push Middle East peace efforts but Craxi told Peres the time was not ripe for a new European involvement.

Peres' unprecedented state visit here, postponed in December after Craxi and Foreign Minister Giulio Andreotti met with Arafat in Tunisia, is regarded by the Israelis as a substantial success. After years of widespread anti-Israeli feeling here, a reception at the Grand Hotel this evening was jammed with Cabinet ministers, representatives of almost all political parties, including the Communists, and top Italian television and movie personalities.