While Pope John Paul II was bidding the Poles of Krakow an emotional farewell yesterday, hundreds of Catholics here at the other end of Eastern Europe crammed into a two-room apartment to celebrate mass.

Refused permission to build enough new churches, Yugoslavia's Catholic Church has turned apartments into makeshift chapels.

Meanwhile, across the town in Zagreb's ornate cathedral, a much more elaborate mass was being held - to mark 11 centuries of Croatia's continuous allegiance to the Roman Catholic Church. Now one of Yugoslav's six republics, Croatia boasts the oldest church in Eastern Europe and, after the Polish, the most active.

Similar in form but very different in their surroundings, the two services reflected both the everday difficulties faced by the church in Communist countries and the depth of its roots.

Inevitably, the first pilgrimage by the first Slav pope to a Communist country has focused attention on the enduring strengths of the church - and the fact that there are two strikingly different philosophies being offered to the peoples of Eastern Europe. But now that the pope is back in the Vatican, a mood of "the morning after the night before" may fit the 50 million or so Slav Catholics.

The euphoria is still present, of course, but so too is a sense that greater religious freedoms will not be granted overnight but must be fought for step by step.

In an interview, the archbishop of Zagreb, Franje Kuharic, agreed that the pope's pilgrimage to Poland had implications for chuch-state relations in other Communist countries, including Yugoslavia.

"On the one hand, this will encourage believers, and on the other, the state will now have to be more respectful toward the church," he said.

But the archbishop went on to list specific grievances for which no solution is yet in sight. They include: the absence of religious education in schools, discrimination against the believers at work, lack of access to the mass media and the state's reluctance to sanction the building of new places of worship.

Compared with the countries of the Soviet Bloc, Yugoslavia has adopted a more accomodating attitude toward religious communities, as Msgr. Kuharic readily admits. Yugoslavia alone in Eastern Europe has full diplomatic relations with the Vatican and the church is allowed to run its internal affairs with little interference.

On reason for this relative flexibility is the government's effort to build a broad consensus for the post-Tito era, a period when Yugoslavia could be subjected to considerable internal strains.

A similar logic applies in Hungary, whose leaders have pursued a policy of national reconciliation since the bloody Soviet suppression of the 1956 revolution. A Western diplomat in Budapest commented: "The leadership here is anxious not to antagonize important interest groups such as the church. And if that means making minor concessions to the new atmosphere resulting from the pope's visit to Poland, it will probably do so."

By contrast, the Czechoslovak authorities have vetoed the appointments of several new bishops, used the official press for unabated antireligious propaganda, and imprisoned priests for distributing religious literature.

Church officials believe the impact of the papal pilgrimage will vary from country to country. It could provoke somewhat contradictory reactions from the region's Communist rulers, as a leading Catholic journalist in Croathia, Zivko Kustic, pointed out.

"The church will now have to be taken more seriously by the state. This will probably mean that some officials will seek ways of lessening the more blatant examples of discrimination, or at least those which quickly become public knowledge. Others, however, will want to control the church more effectivrly. They cannot believe that we do not aspire to political power." he said.

For most East European Catholics, the most important characteristic about Pope John Paul is that he understands their problems. Commented Kustic, who edits Croatia's lively Catholic newspaper Glas Koncila (Voice of the Council): "At last we have a pope who's been through the same school as we and shared our experiences. That's why we feel comfortable with him."

Because of its international nature, the Catholic Church already enjoys a favored position among churches in Eastern Europe. In Yugoslavia, for example, the Catholics are much more outspoken than members of the Orthodox Church, which has is headquarters in Serbia.

A Serbian Orthodox priest, who was reluctant to be quoted by name, explained that the Catholic Church enjoyed the protection of the Vatican:

"The Catholic is like a little boy with his head stuck out of a window. The teacher can smack him only on the bottom. But an Orthodox believer has both his head and his bottom inside the room - and the teacher can smack us wherever he likes."

Here in the apartment churches that serve the 300,000-strong community of new Zagreb, news of the pope's pilgrimage was followed with close attention.

The priest of one such church, St. John the Apostle, said that since coverage of the visit in Yugoslavia's official news media was rather meager, they had to look elsewhere.

"Since we're not far from the border, we can pick up Austrian television here. They devoted several hours' live coverage to the pope, which we were able to follow."

The difficulties faced by churches like St. John's seem to have encouraged rather than deterred the faithful. On Sunday mornings, so many people want to attend mass that services have to be relayed by loudspeaker to those winding up the staircases of the apartment buildings.

A prominent Croatian Catholic commented: "Like the Poles, we have always preferred suffering to euthanasia. We are stronger when we are beaten. When we have freedom, we are inclined to behave stupidly."

The lesson many Catholics in Eastern Europe are drawing from the pope's visit is that, despite 35 years of official atheism, a clear majority of Poles has endorsed the church's view of the world as opposed to the state's. Far from withering away, as Marx predicted, religion is stronger than ever.

Kustic, who went to Poland to cover the visit, said, "The problems will remain of course, but the Catholic Church now has time on its side. We will have to be patient certainly, but never again will we have to fear for the church's existence. We are now sure that it can endure." CAPTION: Map, Catholics in Eastern Europe, The Washington Post; Picture, Pope Paul II is shown image of Our Lady of Krakow during his final mass in Poland before leaving Sunday. AP