The head of Poland's influential Roman Catholic Church, in an exceptionally political sermon two weeks before the planned arrival of Pope John Paul II, today decried "the beating of young people" by Communist authorities and complained about official discrimination against those sympathetic to the banned Solidarity movement.

Amid the pageantry of religious banners and holiday finery marking the observance of Corpus Christi Day, Cardinal Jozef Glemp also said the church would be glad to relinquish to state organizations the middleman role it assumed during martial law of funneling western aid to needy Poles, but he added that the government should stop "infringing human and civic rights and man's dignity."

Meanwhile, the Polish minister for religious affairs, explaining why his government agreed to the politically risky papal pilgrimage, said it would pressure western governments to end the economic sanctions imposed against Poland when martial law was declared in December 1981.

"The visit of the head of the Vatican state and the head of the church will make it much more difficult to continue this policy, which is unfriendly to us," Minister Adam Lopatka told the Polish weekly Polityka, published today. The pope will be the first world leader to visit here since the crushing of Solidarity.

Reagan administration sources have reported that the United States and its NATO allies have begun discussing a gradual dismantling of trade restrictions and other sanctions against Poland. The position of the alliance is said to hinge in part on the outcome of the pope's weeklong visit to his native land beginning June 16.

Lopatka also confirmed that plans for the visit include a meeting between John Paul II and Gen. Wojciech Jaruzelski. The religion minister denied the common assumption that Warsaw's Communist authorities are counting on pictures of the pope greeting the Polish leader to lend a moral advantage or legitimacy to the government.

He said he did not expect riots or street demonstrations during the papal pilgrimage because neither the church nor the government wants them, and the opposition forces therefore would find themselves isolated in protests. Underground leaders have called for calm during the visit.

Glemp, in his address to a crowd of 25,000 worshipers who thronged the streets around St. Ann's Church in Warsaw, said the future social order would depend in large part on what forgiveness is shown by the authorities toward society.

This was an apparent reference to calls by the church and the pope for a blanket amnesty for political prisoners before he arrives. The government has rejected these pleas, arguing that the political situation is too unsettled to warrant release of all those jailed for martial-law crimes.

Glemp's own public statements have turned more critical of the government in recent days in apparent response to the authorities' hardened stand and recent attacks, allegedly by police, against church-affiliated persons and young people. His sermons in Krakow and Ursus, as well as the one today, have heartened a number of the controversial primate's many critics. Younger clergy and members of the intellectual community objected previously to Glemp's generally low-key, conciliatory approach to the Communist regime.

His sharp remarks today drew frequent applause. Charging the authorities with preventing a sense of normality from returning to Poland, the cardinal urged an end to the "discrimination against people who remain faithful to trade unions that have been disapproved"--a reference to Solidarity, which was outlawed last October.

"Education by beating, especially the beating of young people, wakes special objection," the primate went on, noting the recent death of a high school student, Grzegorz Przemyk, which was blamed by the boy's mother on severe blows reportedly dealt him by police.

Glemp devoted a major portion of his sermon to a discussion of the role that the Polish church began to play during martial law last year, namely distributing western food, medicine and clothes outside official state channels. He said the burden of distributing the charity has often diverted the attention of parish priests from their religious duties. He expressed eagerness to let state bodies take it over.

The primate complained of government foot-dragging on a church proposal to funnel western agricultural assistance to Polish farmers. The minister of agriculture recently confirmed publicly that the plan has been under discussion with representatives of the Catholic bishops for months, but he said they have not provided convincing evidence of solid western sources for the project.

Glemp rejected allegations that the Polish church has sought involvement in assistance programs to strengthen its influence in society. "The church doesn't need to do that," he declared. "The church needn't make gestures to confirm its presence in society because it is here in this nation forever, for good and bad."