In a joyous communion with the youth of Ireland and a solemn consecration of the country's most popular Catholic shrine, Pope John Paul II today appealed to the Irish people to protect their strong spiritual and strict moral traditions against the temptations of modern society and Ireland's new prosperity.

"May prosperity never cause Irish men and women to forget God or abandon their faith," he beseeched the Virgin Mary before nearly 500,000 pilgrims at the Shrine of Our Lady in the small village of Knock in western Ireland. "Keep them faithful in prosperity to the faith they would not surrender in poverty and persecution."

It was the second day of the 59-year-old pope's nine-day trip that will take him to Boston Monday and to Washington next weekend.

In an earlier stop today at Galway, farther south along the western Irish coast, the pope delivered the same message in more secular language to a wildly enthusiastic gathering of nearly 300,000 people -- half of them teen-agers -- at a folk mass.

"Do not close your eyes to the moral sickness that stalks your society today, and from which your youth alone will not protect you," he told the cheering, singing, banner-waving youngsters. "On returning home, tell your parents and everyone who wants to listen that the pope believes in you and that he counts on you."

When this call was answered by a prolonged ovation, the pope made a rare impromptu departure from his prepared text.

"You are the strength of the pope," he repeated as they roared again, "the strength of the church, the strength of Ireland."

The emotional experience reached a crescendo when the pope declared, "Young people of Ireland, I love you."

The teen-agers reacted by stopping the service for 20 minutes with a storm of cheering, rhythmic clapping, the chanting of "We want the pope," and the singing of traditional Irish folk songs and "He's Got the Whole World in His Hands."

The teen-agers jumped up and down, shouting and singing themselves hoarse as tears rolled from their eyes. Visibly moved himself, the pope raised his hands to acknowledge the ovation, which touched off still another outburst.

Then, the sun broke out of the clouds for the first time after a drizzly morning, bathing the celebration in bright light.

He had not been able to finish his homily, but the pope beamed and could be heard saying, "Very nice, very nice. It was necessary to do. Now the sun shines a little."

The youngsters, selected from parishes across Ireland for their strong involvement in the church, were suitably reverent at appropriate times during the mass. But their encounter with the pontiff was most notable for its spontaneity, which he clearly encouraged and enjoyed.

The crowd on the flat land around the shrine to Mary in Knock -- where 100 years ago villagers reported seeing a vision of Mary, Joseph and John the Evangelist -- was as enthusiastic as the nearly 2 million people who greeted the pope here in eastern Ireland yesterday. But they and the pope shared for the most part a more solemn attitude of devotion for his message of veneration of Mary and consecration of the Knock shrine on its centenary.

"I come here because I want all of you to know that my devotion to Mary unites me, in a very special way, with the people of Ireland," he told the throng. It fanned out from the village's old stone church, site of the 1879 vision, and the adjacent concrete Basilica of Our Lady, built recently to serve the million pilgrims who now go there each year.

Addressing Mary, traditionally referred to as the "queen of Ireland," he said, "We entrust to your motherly care the land of Ireland, where you have been and are so much loved."

On the second of his three days in Ireland, the pope again moved through a hectic and varied schedule -- including visits with handicapped people and Polish immigrants and a tour of the ancient monastic ruins at Clonmacnois early this morning and formal meetings with Irish bishops late tonight.

But he never seemed to hurry, always finding time to touch another hand among the 2,500 handicapped people he addressed at a special audience inside the basilica at Knock or to slow his rides through the outdoor crowds so everyone could see his face.

He seemed much more at home today with the thousands of words he read in strongly accented English, translated from the Polish in which he wrote them, and made more extemporaneous remarks. Although he approached the officiating of every mass as freshly as the last, he seemed particularly inspired by his reception from the youth gathered in Galway.

They and an equal number of residents of the Galway region, young and old, spent all night and early morning making their way to the port city's racecourse, the scene each year of the Galway races, one of Ireland's most celebrated sporting and social events.

The folk mass began as a pop-music festival, erupted into soccer-crowd enthusiasm when the pope arrived, became a spiritual experience during the celebration of the mass itself and ended with wild adulation for the pope. He rode through the farthest reaches of the crowd, waving his wide-brimmed red hat from the open front of the special van.

When the pope arrived in his orange helicopter and emerged from a robing room in green vestments topped by golden miter, the crowd exploded again and again in great cheers.

But the pope's message to the young people at Galway was quite stern at times, in recognition of the Irish church's difficulty in holding on to young people in a rapidly modernizing Ireland.

"Although you still live in an atmosphere where true religious and moral principles are held in honor," the pope told them, "you have to realize that your fidelity to these principles will be tested in many ways.

"The religious and moral traditions of Ireland, the very soul of Ireland, will be challenged by the temptations that spare no society in our age. Like so many young people in various parts of the world, you will be told that changes must be made, that you must have more freedom, that you should be different from your parents, and that the decisions about your lives depend on you, and you alone."

"The lure of pleasure, to be had whenever and wherever it can be found, will be strong and it may be presented to you as part of progress towards greater autonomy and freedom from rules," he warned."The moral standards that the church and society have held up to you for a long time will be presented as obsolete and a hindrance to the full development of your own personality.

"How many young people have already warped their consciences and have substituted the true joy of life with drugs, sex, alcohol, vandalism and the empty pursuit of mere material possessions?" he asked. "Something else is needed, something you will only find in Christ, for he alone is the measure and the scale that you must use to evaluate your own life."

At Knock, he emphasized his personal devotion to Mary and appealed to his audience to continue with him in that devotion.

His consecration of the shrine will ensure that it rivals Lourdes and Fatima. The vision of the Virgin Mary reported at Knock is unique in that 20 people of all ages in the small, poor village said they saw it at various times on a rainy evening in August 1879. As in all such cases, the church does not insist that anyone believe in the vision, although it formally sanctioned the one at Knock after two lengthy enquiries.

The pope's strict moral and theological statements and strong Marianism have been the subject of some discussion among intellectuals here, as in the United States. Devotion to Mary has been identified with confinement of Irish women in subservient sex roles. That has come into conflict with a growing equality of opportunity in Ireland's belated industrialization and membership in Europe's Common Market.

There is now majority support here for relaxation of laws that restrict the sale of contraceptives to married women with physicians' prescriptions. Growing numbers of women travel to Britain for abortions.

The pope spoke out again today at Knock against the violence that has troubled this island since sectarian conflict broke into the open in Northern Ireland a decade ago.

"We entrust to you this great wound now afflicting our people," he said in the conclusion of his prayer to Mary, "hoping that your hands will be able to cure and heal it."

"Great is our concern for those young souls who are caught up in bloody acts of vengeance and hatred," he said. "Teach us that evil means can never lead to a good end, that all human life is sacred, that murder is murder no matter what the motive or end."

[The Provisional Sinn Fein, the political wing of the Irish Republican Army (IRA), announced Sunday that its ruling body will meet in Dublin Monday night to discuss the appeal for peace in Northern Ireland made by Pope John Paul in Drogheda Saturday. But the group firmly denied reports that it has decided to lay down arms and declare a truce.]

Contributing to this story was special correspondent James LeMoyne.