POPE JOHN PAUL II, stepping into a realm of historical symbolism, prayed today in the dungeon cells of Auschwitz and knelt alone at the Walls of Death there in a solemn tribute to the victims of Nazi horror.

The pontiff then said mass on the rear platform of Birkenau, a nearby faciltity where victims for tha gas chambers were chosen and herded to their deaths. Both camps are period pieces now, maintained in pristine condition by the Polish authoritites as museums recaling the fascist atrocities in which 4 million people died here.

But the pope's visit was more than just a tour or an opportunity for religious and political proganda. From the moment he strode beneath the infamous wroughtiron Nazi motto on the gate of Auschwitz - Arbeit Maxht Frei, or Work Shall Make You Free - John Paul was cast back into the hell of World War II.

No pope had ever been to these places. His presence today as a Pole and leader of the world's Roman Catholics was meant as a highly visible bow to the martyrdom of those who perished in the two camps, including about 2.5 million Jews whom the pontiff singled out for special memory during the mass at Birkenau.

"The very people that received from God the commandment 'Thou shalt not kill," the pope declared, "itself experienced in special measures what is meant by killing. It is not permissible for anyone to pass by this . . . what indifference."

The popehs remarks about the Jews were significant because in the anger and bitterness of Polish communism's anti-Zionism, authoritieshave tended to play down the full fate of the Jews here during World War II.

Departing from his prepared text, the pope also dwelled on Russians who died in Nazi camps and praised the courage of the Soviet people during the war. The sensitive mention of Jew and Russians both drew long applause fron the huge crowd jammed amid the barbed-wore fences, watch towers and prison barracks of Birkenau.

In a pointed reference to tyrannies of the present, the pontiff warned that even Nazi-like excesses are still possible. "Is it enough to put man in a different uniform and arm him with the apparatus of violence?" the pope asked. "is ot enough to impose on him an ideology in which human rights are subjected to the demands of the system so as in practice not to exist at all?"

Then his voice cracking with emotion and fatigue from the efforts of his six days in Poland, the pontiff once again cast aside prepared remarks and proclaimed, "Never, never again war. Only peace, only peace."

The pope arrived at Auschwitz in midafternoon form what was perhaps his most pleasant stopover to date, a visit to his bithplace at Wadowice. His mood visibly turned to one of pain as he made his way to Cell Block 11, known in Auschwitz as the block of death.

Accompainted onl by a few church officials and an official church phototgrapher, the pope went inside to cell number 18 where the leading Polish religious martyr of the war, the Rev. Maximilian Kolbe, was confined.

Father Kolbe, who was beatified in 1971,was a prisoner in Auschwitz at the end of July 1941. When he volunteered to take the place of another man, Franciszek Gajownicezek, who had been selected by the SS to die by stravation. Father Kolb's grim offer was accepted and he was placed in thf cell to starve intil August 14, when he was finally killed with a phenol injection to the heart.

Among those present outside Cell Block 11 today was Gajownicezek, now a robust 78. He was held in Nazi camps until May 1945. a reporter asked him, while visiting church dignitaries from West Germany stood by, whether he had forgiven the Germans for what they did.

"As Catholic it is my sacred duty to forgive," the old man replied, "but as a Pole and as a human I would have to think very long."

Next the pope was taken to the Wall of Death, which adjoins the death cells. There in a narrow courtyard stands a gray wall against which an estimated 20,000 persons were shot to death. Polish officials stood to one side and jostling photographers to the other as the pope walked alone to the wall and knelt in front of a wreath of daisies and carnations.

For several minutes the pontiff remained completely still except for the flutter of his eyelids as they opened and closed in prayer. When he rose, officials clustered around him but the pope barely spoke as the group walked back through the empty prison camp toward his waiting limousine outside.

The public had not been permitted into Auschwitz today, but normally many visitors are there.

There are surreal aspects to Auschwitz now - the ice cream stands inside the compound, for instance, and the dry monotone of guides who have told the same ghastly stories so many times they make them sound almost banal.

With photographers dogging his every step and the general hubbub around him, the pope's visit might easily have turned into a media-oriented nonevent. But ultimately, as the pope's demeanor of sorrow made clear, Auschwitz is no theater set and those for whom the pope prayed this afternoon really died there in terrible ways.

The pope was then transported in his white helicopter the 1.8 miles to Birkenau, which during the war was also known as Auschwitz II. A special altar had been constructed at the terminal point of what was the railway line, now a monument called the Martydom of Nations.

The crowd was so spread out that any real estimate of its size was impossible. Church sources guessed at one million. Included in a place of honor were survivors of the camp, who received communion from the pope.

With gaily colored concession stands erected along the road to the camp entrance, and with worshippers dressed informally for the hot, muggy weather, the gathering was a little bizarre. It was a combination festive outing and prayer meeting in and around the very camp fixtures.

"I am here today as a pilgrim," the pope's voice rang out, "It is well known that I have been here many times. So many times. And many times I have gone down to Maximilian Kolbe's death cell and stopped in front of the death wall and passed among the ruins of the cremation furnaces at Birkenau. It was impossible for me not to come here as pope."

In contrast to other papal activities during his stay in Poland, this one, particularly the visit to the death block, seemed to have official support. Kavimierz Kakol, Poland's minister of religion, was on hand, and the event was televised live around the country. CAPTION: Picture, Pope John Paul II passes through the gates of the Auschwitz concentration camp. UP