Poland's Roman Catholic Church called on the country's Communist leadership today to grant amnesty to those imprisoned under martial law to create favorable conditions for a planned visit here in June by Pope John Paul II.

Though appearing to stop short of making the amnesty a condition for the papal visit, the church letter represented a challenge to the government of Gen. Wojciech Jaruzelski to meet the request or risk new rifts with the clergy in this overwhelmingly Catholic country.

A pastoral letter signed by the Polish episcopate and read at masses across Poland characterized the nation as being "bowed down with great anguish" and burdened by divisions, injuries and human rights violations. Much hatred has resulted which, the letter went on, "must be overcome before the pope arrives."

"We count on the amnesty by civil authorities, as well as other deeds, that would aim at the reinstatement of full social justice and would facilitate a basis for forgiveness and national unity," the statement said. "Let this be our gift for the holy father."

In private talks with state authorities, church officials have repeatedly protested the imprisonment and harassment of former members and leaders of the outlawed independent trade union Solidarity, apparently to little avail. The government has put the number of those in jail for political crimes at 1,500, of whom two-thirds are reported to have been convicted and to be serving sentences ranging up to 10 years.

The letter confirmed plans for the pontiff to arrive June 18 for his second visit to his homeland since assuming leadership of the church in 1978.

But many Poles remain skeptical that the visit will actually take place given the danger, in the eyes of some authorities, that such an event could rouse the country out of the mood of fatigue and resignation brought on during a year of martial law.

Poland's officially controlled television this evening interpreted the letter as meaning that church authorities had confirmed that the pope would arrive in June, adding that this should put to rest doubts about his coming. But the TV announcer omitted mention of the episcopate's call for an amnesty.

The pope's dramatic 1979 trip to Poland strengthened popular political resistance and set off a wave of nationalistic feeling that is credited with setting the stage for the worker revolts that produced Solidarity a year later.

Apparently reflecting Moscow's interest in seeing the visit canceled, the Soviet press last month carried a sharp attack on the pope, saying that under his leadership the Vatican became involved in "subversive" activities in Poland as well as in "anticommunist propaganda on a broad scale."

Nevertheless, Polish Primate Jozef Glemp said as he left for a trip to the Vatican last week that he was confident the pope would come. Glemp is in Rome for a ceremony affirming his recent nomination to the College of Cardinals.

For Polish authorities, the papal visit affords a chance to refurbish the government's image abroad and secure social peace at home.

For the church, the challenge will be to win as much freedom as it can for the pope to tour and speak out, lest the trip appear as an endorsement of the current Polish situation.

At the moment, the church, which represents more than four-fifths of Poland's 36 million people, is struggling not to betray Solidarity's ideals of workers' rights and self-government while trying to avoid any destabilizing or violent protests. The soft-spoken Glemp has been criticized sharply by junior clergy who are dissatisfied with what they charge has been too conciliatory an approach.

The pope's visit, originally planned for last year, was postponed as martial law, declared in December 1981, lasted through 1982. A meeting in November between Glemp and Jaruzelski resulted in the first announcement of the new June date.

No further details about the trip were made public today, but a source familiar with the church-state talks on the matter said the pontiff will probably stay in Poland for about a week, as he did in 1979.

Much of the negotiating between church and state officials has involved mapping out a general itinerary, with the authorities intent on steering John Paul away from the country's main centers of political resistance and church officials pressing for the widest travel possible.

It is understood that agreement has been reached for the pope to stop in Warsaw, Krakow and the holy shrine of Jasna Gora in Czestochowa, as in 1979. In addition, he is expected to go to the industrial towns of Lodz and Wroclaw, and possibly visit Lublin, home of Poland's Catholic university.

But the government reportedly has vetoed trips by the pope either to Gdansk or Katowice, the principal sites of the 1980 strikes and backbone of the Solidarity movement.

The official purpose of the visit is for the pope to participate in the 600th anniversary of the arrival in Poland from Hungary of the "Black Madonna" painting at Jasna Gora. The pastoral letter referred to "the fulfillment of the holy father's right and duty to give his respects to the Queen of Poland."