In his historic visit during which the Irish became "a whole people on pilgrimage," Pope John Paul II evoked a visible religious revival here, boosted Ireland's national confidence and inspired new hopes for eventual peace in Northern Ireland.

Before flying to Boston this afternoon, the pope further established himself as an influential international leader able and willing to motivate vast masses of people with his charisma, and as a staunch defender of traditional Catholicism against the secularizing trends of modern society.

"There is no heart beating in a Irish breast which has not felt its pulse quickened by your presence," Cardinal Thomas O'Fiaich, archbishop of Armagh and primate of all Ireland, told the pope today as he bade him farewell. "The Irish people have been a whole people on pilgrimage and a nation at prayer."

The pope attracted far larger crowds than expected at every stop of his hectic, morning-to-night tour of Ireland. By conservative estimates, the audiences at the outdoor masses and other papal appearances across this small country totaled nearly 3 million people.

Even accounting for those people who managed to attend more than one event, at least half of the combined population of more than 5 million in Ireland and British-ruled Northern Ireland -- almost 4 million of whom are Catholics -- saw the pope in person. They camped overnight, walked miles in early morning darkness and endured traffic tie ups for up to 12 hours to get to him.

In his presence, they were captivated by the burly, gregarious, and alternately irreverent and deeply religious pontiff. He established personal rapport with them, speaking in the first person, declaring in Gaelic and English, "I love you."

And the young, whom the sober Irish church has been losing to a rapidly secularizing society, were excited by his ad lib humor, warm paternal smile and youthful body language. This morning, as young seminarians from throughout Ireland roared their approval in the neo-Gothic chapel of St. Patrick's College of Maynooth near here, the pope, on his way up the altar steps, shot up both fists in acknowledgement, like an athlete responding to the crowd's cheers after a goal.

"A week ago, I was not going to come to see the pope because I'm not much of a Catholic," Catherine Sammon, a 30-year-old secretary from Londonderry in Northern Ireland said at Sunday's emotional youth mass at Galway in western Ireland. "But then I felt like a hypocrite and came. It's been the experience of my life. I'm going to go to mass more often."

"We can't tell you how we felt when our pope sang to us," said 23-year-old Thomas Cunningham after the pope joined in the teen-agers' spontaneous sing-along at Galway.

The pope also created " a fever in the country for peace," in the words of an Irish government official, with his extraordinarily strong and eloquent condemnation of violence in Northern Ireland. The Irish official said the Provisional Irish Republican Army was put on the defensive by the pope in the struggle for support among young Irish Catholics.

"As a northerner," said Sammon, "I especially liked his talk on the troubles. He spoke for us, not to us. He said what we all really feel and what we all want to say. We are ashamed at the terrorism, at the murders like Lord Mountbatten's. We are ashamed to have killers among us.

"It thrilled us to have the pope condemn them and help us," she added. "This weekend gave Ireland the chance to show the world that we are not a nation of hooligans and murderers. We have a dignity. He has helped us show it."

The 12-man Provisional IRA council is to meet here Tuesday to discuss the pope's plea for peace. But today IRA gunmen in Belfast fired on passing troops from the home of Catholics who had gone to see the pope. The gunman took over the home from its owner, who was guarding it while his wife and four teen-age children joined other Ulster Catholics in the pilgrimage south. When they returned home, they, too were held hostage until dawn by the masked men, who escaped.

The terrorist shooting, in which two soldiers were slightly injured when the vehicle went out of control, occurred before the pope left Ireland. It was the only serious incident during his visit.

British Prime Minister Margaret Thatcher today welcomed the pope's call for an end to violence and said her government was working with both communities in Ulster "to find a way in which the people of Northern Ireland once again assume more responsibility of their own affairs and the future.

"We earnestly hope," she said in a statement, "that the pope's message will help to create a new spirit of cooperation and understanding among all the people of Northern Ireland and will help to free them from terrorism and fear."

Many other British and Ulster politicians joined Thatcher in welcoming the pope's strong condemnations of violence.

Some, however, expressed misgivings about his frequent references to past persecutions of Irish Catholics by the British and the Protestant majority in Ulster.It was necessary for him to do this, one ,rish police officer on the papal security detail said. "We Irish," he explained, "all remember our history. It is hard to forget and get along."

The pope also mixed his joyous communion with stern admonitions to protect the faith and traditionally strict Irish morals against the temptations of modern, more prosperous and open life in Ireland.

Today, in particularly strong sermons to the seminarians and others at Maynooth and at another huge outdoor gathering of 250,000 people at the Limerick racecourse in western Ireland, he attacked, among other things, divorce, abortion, birth control, the lure of non-religious careers for women, and the trend among some priests and nuns to stop wearing traditional religious dress.