Four years after his triumphal first visit as pope to his native Poland, John Paul II returns here next week for what many regard as a considerably more difficult and politically risky pilgrimage.

The millions in Poland who experienced the 1979 visit, viewing the unprecedented presence of a pope--let alone a Polish-born one--in a Soviet Bloc state as the miracle of a lifetime, are less certain what to make of this second papal visit.

The first trip here stirred emotions that, a year later, found expression in the Solidarity movement. Can John Paul II do it again? Will he even try?

In this overwhelmingly Roman Catholic country, a surging eagerness just to have the pope in Poland again overrides what political reservations people have about the trip.

Most Poles want him here--for his comforting words, for the excitement the visit is sure to generate, for the enormous crowds that are expected and the accompanying feeling, as in 1979, of a nation united under something infinitely greater than communism.

But beneath this anticipation run currents of anxiety and nagging doubts about the timing of the visit given the continuing repression exercised by the government of Gen. Wojciech Jaruzelski and the worry that, as the first world leader to come to Poland since the imposition of martial law nearly 18 months ago, John Paul II could be manipulated by the government into seeming to bestow a certain legitimacy on Jaruzelski's rule.

Also frequently voiced are fears for the pope's safety in Poland, considering how much easier life conceivably would be for Polish and Soviet authorities without a Polish pontiff. Security arrangements for this pilgrimage are much tighter than in 1979.

"The last papal visit to Poland was a great success," recalled Cardinal Franz Koenig in an interview in his archdiocese, Vienna. The Austrian cardinal is a seasoned observer of East European affairs and is said to have been instrumental in the election of John Paul II. "The second visit is difficult for him. So many expectations accompany such a trip because so many things are possible."

Last time, it was a joyous, laughing pope, new as head of the Roman Catholic Church, who returned to his homeland for a euphoric and prideful celebration that heightened Polish nationalist sentiment. He tore taboos off some political subjects and liberated psychological forces of hope, self-confidence, freedom and a sense of involvement. This time, the pope will confront a Poland in economic misery and mental anguish, a nation nursing deep grudges against a communist regime that crushed hopes of greater political freedom.

Last time, the pontiff was welcomed nervously by a Communist leadership, headed by then-party chief Edward Gierek, which had been compelled to invite him by the unprecedented circumstance of having a native son elected pope. This time, John Paul will be greeted by a regime that is shrewder in its propaganda than any previous Polish Communist government and that invited him in a coolly calculated, albeit chancy gamble to help pacify the country and break the West's political and economic blockade against Poland.

Last time, the pope, without fully realizing it, caught a rising wave of social revolution in Poland. This time, he arrives in a trough of national despair.

A large element of unpredictability hangs over this papal homecoming. It could conceivably backfire on the authorities by giving rise to a new emotional surge and consequent political explosion. At the other extreme, it could damage the pope's prestige as well as public confidence in the church by failing to meet society's expectations and leaving a sense of profound disappointment.

"Everybody is afraid," observed Stefan Kisielewski, a Polish Catholic writer and editor, about the pope's trip. "The people are afraid that it will increase the authority of the government, and the government is afraid that the underground Solidarity will emerge. The church, too, is not sure what results this voyage will bring. We know that until now John Paul has always won."

Though ostensibly a religious pilgrimage, the visit of the 63-year-old pontiff will have an undeniably political impact, not only in Poland but also throughout the Soviet Bloc where Communist governments are engaged in varying degrees of accommodation and conflict with religious groups.

The East Germans and Czechoslovaks are known to be against the trip, fearing a strengthening of the church in this part of the world. The Soviets, who have attacked the pope for fomenting the rise of Solidarity and supporting subversive activity elsewhere in Eastern Europe, appear to have begrudgingly accepted Warsaw's wishes in the matter.

Meanwhile, the Reagan administration and the European allies have let it be known that a possible rollback of trade restrictions and other sanctions against Poland turns in part on the outcome of the visit.

In recent days the political jockeying between the Roman Catholic Church and the Jaruzelski regime in connection with the pilgrimage has intensified. Calls by the church for a blanket amnesty for political prisoners before the pope arrives have been rejected, prompting the church to toughen its public criticisms of the state for trampling human rights.

Hoping to defuse the issue--and avoid a papal scolding--senior Polish officials including Deputy Premier Mieczyslaw Rakowski and Interior Affairs Minister Czeslaw Kiszczak have suggested in off-the-record talks with western visitors that the regime is considering a final lifting of martial law around July 22, a national holiday. Martial law was suspended last December.

But the absence of major concessions before the visit has caused some to argue that the political price of the pilgrimage is too high.

"The pope's visit is morally dangerous to us," said Jerzy Lojek, a historian at Warsaw University. "The visit is likely just to help the government. It should have been conditioned on concessions. Without these, the visit is a political mistake."

Others disagree. The Rev. Jozef Tischner, a highly respected religious philosopher in Krakow who is a close friend of the pope, said the pilgrimage--which he described as a "samaritan visit"--is well-timed. But he cautioned against expecting immediate results, saying the full impact may not be felt for some years.

"The point of view of politics is short, that of apostolic missions is counted in epochs," Tischner said. "When we take both into consideration, I think the visit comes at the proper time."

Hansjacob Stehle, a West German correspondent who has covered the Vatican for 13 years and is an authority on the Vatican's policy toward Eastern Europe, said of the forthcoming trip: "The pope goes to Poland as a pastor to an ill patient"--that is, to comfort rather than to cure.

Asked why John Paul has agreed to go to Poland now, Koenig, who recently saw the pope, replied: "He regards the visit as a duty, as something he must do."

The Roman Catholic Church in Poland is the mightiest religious institution in Eastern Europe. Its appeal--nearly 90 percent of the country's 36 million people profess to being Catholic--derives not just from religious roots but also from the church's close identification with Polish nationalism beginning in 966 when Mieszko, Poland's first ruler, had himself baptized.

In post-World War II Poland, the church has served as a bulwark against communism. Its priests were often the only figures able and willing to speak out in public on matters of social concern. Its halls were the only place where serious debate on public policy was possible.

Solidarity incorporated the rituals and symbols of Catholicism on important and solemn occasions. This did much to reinforce the movement's essentially pacifistic character.

In turn, the development of a genuinely independent political movement in Poland raised the prospect that the church might finally be able to assume a more relaxed, "peacetime" mission and again concentrate on purely theological and moral issues.

Instead, with the imposition of military rule at the end of 1981, the church was forced to revert to its traditional role as protector and defender of the nation. This has brought new strains within the church.

On the whole, Poles appear to have an abiding faith that the pope, no matter what challenges he faces here--whether to revive Polish spirits or smooth differences inside the Polish church--will somehow turn the pilgrimage into a success. Repeatedly, in conversations about the planned week-long visit that begins June 16, people here referred to other politically trying trips that John Paul managed well--notably, to Britain and Argentina during the Falklands War and to Central America.

"He will find the right words," declared Jerzy Turowicz, editor-in-chief of Poland's leading Roman Catholic weekly, Tygodnik Powczechny. "The visit will be, it must be, a success. Of course, some people are expecting a kind of miracle, and of course, a miracle won't happen.

"After the visit the social and political situation will be the same. But people will regain a sense of social cohesion, an injection of hope. This will be a factor with some political meaning."

The expectations that Poles have for the papal mission are apt, some here say, to do more to determine the success or failure of the pilgrimage than what John Paul II actually says or does.

Jacek Szymanderski, a former Solidarity activist and a historian at Warsaw's Academy of Sciences, worries that expectations may be too high, especially among those wanting John Paul II to be a kind of scourge against Jaruzelski.

"In 1979 we didn't expect him to do anything concrete," Szymanderski said. "We just enjoyed and appreciated him as a symbol of success against oppression, of the elevation of Catholicism above communism. Now we expect something from him--that he will settle many of our problems and will somehow muzzle the government. Many want him to take revenge.

"It is impossible for him to meet all the expectations, and this is dangerous for us. The authorities have not been strong enough to disintegrate our feeling of 'we,' but the failure of our own hopes could be enough to do that."

Churchmen privy to the pope's thinking, including Tischner and Koenig, indicated that John Paul would most likely avoid a political clash and, having come to console Poland, would stress such themes as patience, reality and religious renewal.