ROME (AP) _ Pope John Paul II, distancing himself from Italian leftists and pacifists who have rallied around his anti-war statements, declared Sunday that he does not seek ''peace at any cost.''

The pontiff, in off-the-cuff remarks at a Rome parish, apparently sought to blunt attempts by Communists and others to use his peace appeals for their own campaign against the Gulf War.

''We are not pacifists,'' the pope said. ''We don't want peace at any cost.''

''A just peace, peace and justice,'' he repeated. ''Peace is always the work of justice.''

The pope returned to the justice theme a few hours later during noon remarks from his balcony overlooking St. Peter's Square in Vatican City.

He said Lent - the 40-day period of fasting and penitence before Easter - is a time for Catholics around the world to pray for ''the gift of peace in justice.'' The words ''peace in justice'' were underlined for emphasis in the written Vatican text of the speech.

By justice, the pope meant respect of the rights of sovereign Kuwait as well as those of Iraq, Palestinians and all people of the Middle East, according to Vatican spokesman Joaquin Navarro.

Since Iraq's Aug. 2 invasion of Kuwait, the pope has made more than 40 public appeals for a peaceful solution of the crisis.

He has strongly condemned Iraq's action but warned that war will only provoke tragedy and new injustices and increase divisions between rich and poor, East and West and Christians and Moslems.

The pope's appeals have created political controversy in Italy, raised the ire of some Jews and chilled U.S.-Vatican relations.

John Paul's Christmas Day warning that ''war is an adventure with no return'' became a slogan and rallying cry for Italian Communists and other opponents of the Gulf War. The Christian Democrats, long close to the church, support Italy's participation in the war.

''The pacifists have their own ideology,'' Monsignor Pietro Rossano, rector of the Pontifical Lateran University, said in a recent television interview. ''They criticize only one side. The church doesn't want to be associated with this. It only wants peace.''

The Gulf War and Iraq's Scud missile attacks on Israel have led Jewish groups and some promiment politicians in Italy to push for the Vatican to establish formal diplomatic relations with the Jewish state.

The pope has called for an international peace conference to resolve all Middle East problems, including the Palestinian question. This has put him at odds with the United States, which rejects any semblance of linkage between the Gulf situation and other issues.