The transition at the Vatican comes at a time of opportunity. For Pope Paul VI has mended Rome's fences around the world in a spectacular fashion.

But the church's standing in Italy is low and sinking lower. So the next pope has rare chance to play an effective role in the swirling chaos known as Italian politics.

The intense and respectful attention paid by the American press and television to the death of Pope Paul provides a good measure of the relations between the Vatican and this country. Anti-papist feeling, once virulent, has now practically disappeared inthe United States.

Measures to provides aid to students in Catholic schools enjoy more congressional from the White House. The president has a personal envoy at the Vatican, and the issue is so uncontroversial that even foreign-policy experts do not know that he is David Walters, a Miami businessman.

In most of the Third World, the church has long since shaken off its losing alliance with colonial and landholding interests. Most of the opposition to the military regimes in Latin America, notably in Brazil, Chile and Argentina, comes from courageous priests and bishops.

In Asia and Africa, the church is also on the side of the dispossessed. While under pressure now, the Catholic prelates are moving with the spirit of the times in the underdeveloped countries.

In Communist Eastern Europe - with Pope John XXIII taking the lead and Pope Paul following his footsteps - the church has moved from confrontation, the better to perform its pastoral mission. There are regular, routine meetings between Vatican officials and Polish diplomatic representatives. A formal exchange of envoys is probably only a matter of time.

Paul VI arranged that the perecuted primate of Hungary, Cardinal Mindszenty, be transferred from his sanctuary in the American embassy in Budapest to Vienna. When Cardinal Mindszenty died in exile, a less assertive prelate, Cardinal Leki, was designated primate of Hungary. The Hungarian government has now allowed most of the bishoprics to be filled - a sure sign that suspicion of the church as a subversive force with foreign loyalties is on the wane.

Finally, Pope Paul continued the ecumenical emphasis of John XXIII. He eased the tensions between Rome and the other christian churches, especially the Anglicans in Britian and the Orthodox church of the eastern Mediterranean. The unity of Christendom, while still a distant thing, is closer than it was before he assumed the papacy.

In Italy, however, the papacy of Paul has seen a steady decline in the fortunes of the church. At the root of that decline is a massive demographic shift. For centuries the church found its most potent support in the poor, rural villages of southern Italy.

But the Italian economic miracle of the 1960s drew a majority of the poor villagers to the booming northern cities. Many also went as guest laborers to Germany and other northern European countries. While the church remains a power in the deserted countryside, it has not followed the population shift to the modern cities.

One immediate result is the almost steady decline of the Christian Democratic Party, which has been a kind of secular arm for the church. The Christians Democrats have not only lost majority control in the Italian parliament; they have also lost, to the Communists, control over every major Italian city, including Rome, Naples and Milan.

Another result is the defeat of the church on many of the issues most dear to its heart. A plebiscite in 1974 showed a huge majority in favor of divorce. Parliamentary votes and polls show public opinion to be in favor of abortion and cool toward priestly celibacy. The very basis of current Italian politics - a Christian Democratic government in office thanks to Communist support - is anathema to the Vativan.

Pope Paul bears no small part of the blame for the church's troubles on its home ground. He stood for positions upopular with the mass of Italians and contracted alliances with Christian Democratic leaders unable to bring themselves and their party abreast of the times.

So perhaps the most critical, secular matter at stake in the selection of a new pope concerns the impact inside Italy. The right choice would favor the rejuvenation of the Christian Democratic Party and the strengthening of Italian democracy against the Communist challenge.