Pope John Paul II told Latin Americans today to avoid "the interference of foreign powers" in their search for development and a lasting peace.

Addressing a crowd of 30,000 that included nearly 150 visiting bishops, the pope did not specify to which powers he referred but said they "follow their own economic interests, or the interests of blocs and ideologies, and reduce nations to training grounds at the service of their strategies."

In the concluding address of a 70-hour visit here, the pope also denounced "the promoters of religious sects that have little or nothing to do with the true content of faith" and those who "attempt to build a 'popular church' that is not Christ's." He later flew to San Juan, Puerto Rico, where he met with Secretary of State George P. Shultz before returning to Rome.

The pope's allusion to a "popular church" followed his strong criticism yesterday of the focus on class conflict under the doctrine of "liberation theology."

The Vatican is engaged in an extended conflict with the Marxist-led government of Nicaragua, where priests backing the Sandinista rule have participated in a "popular church" in conflict with the more conservative Roman Catholic hierarchy there. Four priests serve in the government despite pressure from Rome for them to step down. Nicaragua's bishops were not among those in attendance today.

Nicaragua accuses the United States of seeking to impose its ideology by backing guerrilla forces that seek to overthrow the Sandinistas. The Reagan administration has charged Nicaragua with propagating pro-Soviet ideology.

The veiled reference to liberation theology was the pope's only mention of the doctrine in today's speech in a crowded stadium, although church officials had speculated earlier that the pope would address the subject at greater length while speaking to the bishops there. The bishops are inaugurating a religious celebration of 500 years of Roman Catholicism in the New World that began with Columbus' voyage in 1492.

The Vatican in recent months has focused attention on liberation theology, a doctrine proposing a "preferential option for the poor."

It is the great unspoken topic at the Catholic gathering here and the issue that most divides the Latin American church today. Among the bishops present here are Colombian Cardinal Alfonso Lopez Trujillo, a fervent opponent of the radically egalitarian doctrine, and Brazilian Bishop Ivo Lorscheider, a supporter of the new theology.

In recent months the Vatican has decided to tighten its control of the radical Latin Americans who espouse this doctrine.

In September, the Vatican's Sacred Congregation for the Doctrine of the Faith issued a critique of liberation theology, focusing on its use of Marxist methods of analysis. A few days later, a leading liberationist, Brazilian priest Leonardo Boff, was summoned to Rome for a hearing by the Sacred Congregation, once known as the Holy Office.

Two liberation-minded Brazilian bishops traveled to Rome with Boff as his spiritual bodyguards, and he emerged from his hearing with no motion of censure.

The head of the of Sacred Congregation, Cardinal Joseph Ratzinger, also has been pressing the Peruvian bishops to censure theologian Gustavo Gutierrez, who wrote the book that gave the movement its name. The bishops failed to agree on a censure document.

Perhaps no one has captured the zeal of the new church more than Gutierrez, the Peruvian theologian. In an interview last month with the Lima daily La Republica, he was asked what it means to be a priest in a country like Peru.

"It means not becoming accustomed to seeing the newspapers filled day after day with pictures of mutilated corpses," he said. "It means not getting used to the fact that fellow human beings must search the garbage to find something to eat . . . . It means maintaining a permanent attitude of shock and rejection in the face of all these indignities. Not to do so would be to compromise one's own human dignity."

The Vatican presumably has no objections to this vision of social justice. Implicitly, John Paul II has expressed the same objections as the Sacred Congregation: the use by liberation theologists of Marxist principles of social and economic analysis to explain the causes of poverty.

Yesterday, the pope stressed that church activists must not "see the poor as a class, as a class in struggle, or as a church separate from . . . pastoral obedience." The Sacred Congregation document warns against the use "in an insufficiently critical manner, of concepts borrowed from various currents of Marxist thought."

But despite the Vatican's need to assert its authority, there are some indications that the two sides are closer ideologically now than before. After Ratzinger's statement on liberation theology in September, a chorus of church liberals and radicals proclaimed it one of the most socially progressive statements issued by the Vatican.

"We have received this document with hope," wrote radical theologian Pablo Richard, a former priest now living in Costa Rica. Richard quoted approvingly the section of the document that condemns those "who contribute to keeping the people in misery, who profit from that misery or are resigned or indifferent before it."

The document goes so far in its condemnation of unjust social structures that Avery Dulles, a professor of theology at Washington's Catholic University, was moved to write, "One welcomes the suggestion . . . that the causes of poverty should be rigorously examined. Such examination might show . . . that poverty would be aggravated if foreign investments were not attracted."

Almost six years of travel appear to have modified the pope's world view by showing him some of the depths of Third World misery. Today's address also touched on the effects of the Third World's growing debt to Western banks.

The debt, he said, "can create conditions of indefinite social paralysis, and condemn entire nations to a permanent debt whose serious repercussions can generate permanent underdevelopment." He echoed statements of radical pastors.