Having suddenly found itself afloat on a vast sea of oil, Mexico has begun refitting its 63-year-old "institutionalized revolution" for a voyage into the realm of world leadership, and some U.S. analysts fear it may be charting a potential collision course with Washington.

In bits and pieces, the outline of the new Mexican policy has been emerging for some time, but it was stated most boldly on Monday in President Jose Lopez Portillo's fourth annual state-of-the-nation address.

Despite -- perhaps even because of -- its still persistent problems of underdevelopment, Lopez Portillo suggested, Mexico is in a unique position of potential leadership.

"We are the frontier between the world of poverty and the world of power and wealth and between the predominant cultures of this continent," he told the Mexican Chamber of Deputies. "We are the hallmark and the beacon. Let us stand for advancement and progress as well."

Lopez Portillo described the day-to-day bilateral relations between his country and the United States as having "gained in clarity" in the year since his last meeting with President Carter. "Useful easy and cordial," Lopez Portillo termed the current atmosphere.

But in a remark that earned a standing ovation, he made it clear this does not necessarily stretch to foreign policy. Mexico expects to have "a worthy place standing erect in the world, not a seat in a sphere of influence," he said.

The keystone of Mexican foreign relations, at least since 1917, has been that, "No nation may interfere for any reason in the internal affairs of another. All, without exception, must adhere to the ideal nonintervention."

For most of this century, Mexico was itself periodically on the verge of foundering beneath the weight of internal problems and had neither the wealth not the apparent desire to exert itself internationally. This policy resulted in an essentially passive world role.

The principle of nonintervention is still proclaimed as essential. Yet over the last two years, the exercise of Mexican foreign policy has become decidedly active, both in global initiatives proposed before the United Nations and, most conspicuously, in its relations with the other nations of the Caribbean basin.

Of particular concern to U.S. policy-makers has been the growing warmth in Mexico's relations with Cuba and its tolerance, even quiet encouragement, of leftist revolutionary movements in Central America.

The expressed hopes of both Mexico and the United States for major social change in the area are not much at variance. But the Mexicans, while certainly not espousing violence, appear more inclined to accept the inevitability of armed insurrection than the United States.

"Mexico feels," said one U.S. analyst, "that, as in the case of its own revolution or the Cuban, once so much injustice has built up, so much hatred has accumulated, it is impossible to effect change without violence. They tend to think that we are naive for trying to seek other means."

According to this analyst, Mexico's policy is basically to let revolutions run their course and then say, "Can we help you?"

As they try to catch the rising wave of revolution, the Mexicans have deliberately forsaken good relations with the militaristic regimes of neighboring Guatemala and El Salvador, the latter strongly backed by Washington.

Last year, when the United States was still actively trying to avert a Sandinista takeover in Nicaragua, Mexico pointedly undermined U.S. policy by breaking relations with the Somoza regime. The move considerably strengthened the Sandinistas' international diplomatic position.

It was not lost on U.S. policy-makers that the breaking of relations with Somoza followed close on Cuban President Fidel Castro's first state visit to Mexico.

Mexico never broke with Havana, despite U.S. pressure, and relations between Cuba and Mexico have been warm ever since 1970. But as Mexico seeks to strengthen its foreign policy role in the area and among the nonaligned nations of the world, the links to Castro have grown ever stronger. n

During the worst days of the Peruvian Embassy crisis in Havana and the beginning of the Cuban exodus last spring, as world criticism of Castro's regime was mounting, Mexico lent him a diplomatic hand by announcing an intended formal visit to the island by Lopez Portillo.

When the Mexican president arrived in Havana in July, he was accorded the kind of massively warm reception normally reserved for visiting dignitaries from the Soviet Bloc. He reciprocated by affirming, among other things, Cuba's right to be rid of the U.S. base at Guantanamo.

The Mexicans see their policy essentially as one of open communication that ultimately, though perhaps incidentally, may actually help the United States by defusing potential confrontations in the area and leaving the door ajar to moderation through persuasion rather than coercion.

Some observers believe this left-leaning policy also helps defuse potential unrest at home in Mexico. "You won't get the Cubans or the Salvadoran or the Guatemalan guerrillas playing hanky-panky with the left here at the expense of the government, because everyone is supposed to be on the same side," said one observer.

In fact, the heart of Mexico's new foreign policy may be found in the history of its own political development.

Although there are numerous political parties in Mexico, only one, the Institutional Revolutionary Party, wields real power. It has survived intact and totally dominated Mexican political life for most of the century through its ability to absorb, co-opt, buy off or, if necessary, eliminate serious opposition. As part of this strategy, it has also shown itself flexible enough to bend considerably with the strongest currents of public opinion.

A common view among foreign analysts is that Mexico is now attempting to apply this complex and endlessly refined domestic strategy -- used successfully during the 1970s to eliminate the threat of radical left -- to its relations with revolutionary movements elsewhere in the hemisphere.

The problem, as some U.S. officials see it, is that this policy may not work on an international level. If it fails, particularly in El Salvador and Guatemala, Mexico itself may be threatened.

"If Mexico's policy works," said one observer, "then U.S. interests may be served as well as Mexico's. But since we have no choice or desire to influence Mexican foreign policy, all we can do is hope for the best."

Indeed, Mexico is currently so sensitive about its new foreign initiatives that when U.S. Ambassador Julian Nava said recently that neither Washington nor he "understands" the warming relations between Cuba and Mexico -- between a totalitarian communist and an essentially democratic capital state -- he was roundly denounced for interfering in Mexican affairs.

Some editorialists, even in relatively conservative newspapers, called for Nava's resignation or replacement. There was open speculation in the press that Lopez Portillo might himself demand such a move in his state-of-the-nation address.

There were also hopes in some quarters that the Mexican president would announce a break in relations with the U.S.-supported regime in El Salvador, a particularly sensitive point of friction between the United States and Mexico.

There were no such bombshells, Nava was never mentioned, and El Salvador was conspicuously absent from the numerous nations of the hemisphere to which Lopez Portillo devoted his attention.

Although it is new, nothing about Mexico's foreign policy is precipitous. Rather, as Lopez Portillo outined it, it seems as effort to walk softly and carry a big bucket of oil.

Mexico is now the fifth-largest petroleum producer in the world and located in a region where governments -- whatever their ideological slant -- are desperately in need of energy supplies. As part of the global energy plan that has been proposed by Lopez Portillo, Mexico and Venezuela have recently initiated a scheme for cooperation with the nations of the Caribbean basin to guarantee petroleum supplies on generous credit terms.

Such a program could supply significant leverage over these countries, if Mexico felt it were needed.

There is about the entire initiative on which Mexico has embarked a mixture of straightforward pragmatism, realism, and hope that it all works.

"International society is not a product of reason but of history," Lopez Portillo told his countrymen Monday. "Countries are what they have been able to become, not what they wanted to become. To judge the relations of Mexico on the basis of personal sympathy or antipathy is a poor attitude. The pluralism that we practice internally is also the standard for our conduct abroad."