President Reagan today opened a week of ethnic politicking by invoking the names of Pope John Paul II, Lech Walesa, the Polish Home Army and the outlawed Polish trade union Solidarity in an appeal to Polish-American voters at a national religious shrine here.

Reagan also charged today that the Soviets "violated" the 1945 Yalta agreement between the United States, Britain and the Soviet Union that helped to establish the postwar East-West division of Europe.

Spotting signs in the crowd urging him to "nullify Yalta" and "renounce Yalta," Reagan departed from his prepared text. "Let us not be tempted into giving Yalta as coverage to those who have violated that agreement," he said, adding that the agreement "never gave them the power to dominate the nations of Eastern Europe and Poland as they have."

Critics have said the accord set the stage for Soviet control of Eastern Europe, and Reagan said in August that the United States could not passively accept the "permanent subjugation of the people of Eastern Europe."

His remark today, that Yalta had been "violated," was met with cheers of "four more years" by a crowd of about 10,000 assembled outside the National Shrine of our Lady of Czestochowa, which was founded by the Pauline Fathers.

Reagan likened the Polish Home Army's struggle against Nazi oppression in World War II to present-day opposition to Poland's Soviet-backed regime.

"Those who believe they have crushed the Polish spirit with guns and brute force are wrong," he said. "They should remember the Polish Home Army and remember that lesson of history: Poland may be temporarily subdued, but the Polish people will never be defeated."

Reagan, who imposed sanctions on Poland after martial law was declared in 1981, lifted some of the measures after the Polish government suspended it, but has left other sanctions in place. He did not mention any further action today toward the Polish regime.

Reagan's appearance on the last day of a Polish-American festival here was the first in a series of campaign events this week targeted at Roman Catholic ethnic voters, many of whom are conservative Democrats important to his reelection strategy in the Northeast and Midwest. Later this week, Reagan will speak to Hispanic and Italian-American groups.

The president appeared to have some difficulty reading his remarks today, repeating one line and stumbling over the name of a Republican congressional candidate, Dave Christian, because "I can't read my own writing."

He was introduced by Cardinal John Krol of Philadelphia, who praised Reagan's recent comments on the role of religion in politics. The constitutional separation of church and state, Krol said, "can never be interpreted to prohibit individuals who are religiously motivated from taking a position on issues of public concern."

Reagan laid a wreath at the memorial of Ignace Jan Paderewski, the pianist and first prime minister of the Republic of Poland after World War I; paid tribute to Solidarity leader Walesa; and declared, "Thank God for Pope John Paul II."

Separately, Reagan told the Sunday Times of London, in an interview and answers to written questions published today, that the Soviets "continually backtracked and invented excuses" not to attend talks in Vienna they originally proposed for this month to discuss controls on space weaponry.

Reagan said the nuclear arms race "really doesn't make any sense."

"We've come to a point now that a previous president of ours, Dwight Eisenhower, said might happen. We've come to a point where a war with the weapons now at hand -- there is no foreseeing a victory or defeat in the traditional terms. The weapons are capable of destroying mankind and civilization. When that time comes, as he, himself, said then, then it is time for the nations to sit down and find another way of settling disputes."