Pope John Paul II and Soviet Foreign Minister Andrei Gromyko, meeting for the first time in six years, spoke for almost two hours today about "peace in the world" and the status of Roman Catholics in the Soviet Union, according to a Vatican spokesman.

Although the Soviet Union and the Vatican do not have formal diplomatic relations, the Holy See gave Gromyko a red carpet welcome, with extra complements of Swiss Guards in ceremonial dress stationed at all the entrances of the Apostolic Palace.

At the end of the 108-minute meeting, which was also attended by two top Vatican officials and two ranking Soviet aides, Gromyko said the meeting had been "good."

Gromyko last met with the Polish-born pontiff in 1979, before the onset of the crisis in Poland involving repression of the independent trade union Solidarity and the 1981 attempted assassination of the pope that has been linked in some accounts to the Soviet Bloc.

The foreign minister said the question of a visit by John Paul II to the Soviet Union was not raised. Last August the pope said he and Cardinal Agostino Casaroli, his secretary of state, had been denied permission to visit Lithuania, the home of 2 million Roman Catholics and thus the bastion of the church in the Soviet Union.

Later, Gromyko met with Italian President Sandro Pertini for an official luncheon that was described as cordial. Several hundred Italian students held a demonstration calling for the withdrawal of Soviet troops from Afghanistan, but marchers seeking to arrive at the presidential palace were blocked by police.

Neither the Vatican nor the Soviets released details of today's exceptionally long conversation beyond the Vatican spokesman's characterization.

Church sources earlier had said topics would almost certainly include human and religious rights and such East-West questions as the coming arms talks in Geneva. Gromyko, who arrived in Italy Monday, has been seeking support for the Soviet opposition to the Strategic Defense Initiative of President Reagan. Yesterday, Gromyko called on the Italian government to speak out against the plan.

The pope has yet to take a public stance on this issue.

For the Holy See, the most crucial topic, the sources said, was that of religious freedom and the status of Roman Catholics in the Soviet Union. Although a recent Soviet decision to allow the nomination of two new Lithuanian bishops has eased tensions somewhat, the pope is known to be concerned over pressures there on both clergy and ordinary Catholics.

Vatican officials also have spoken of "religious persecution" in the Ukraine that began in 1945 when, they say, about half of the 3,000 priests were arrested and another third were forced to convert to the Orthodox Church.

The Vatican has been unsuccessful in its persistent attempts to get the Soviets to agree to the appointment of new bishops in the region. Another several million Roman Catholics are believed to live in other parts of the Soviet Union.

Since the explosion of the Polish crisis, relations between the Vatican and the Soviets have been tense. Over the past two years, Soviet and East European publications have frequently attacked the pope in strong terms, most recently because a document criticizing liberation theology that was released by the Vatican last September included sharp criticism of the Soviet Bloc.