Mozambique's ruling party has just shown its allegiance to orthodox Marxism-Leninism with such gusto and profound commitment that some Western observers here think they may be witnessing the birth of "Afrocommunism."

If so, it seems destined to be an extremely nationalistic brand of communism, probably as independent-minded and troublesome to Moscow as Eurocommunism is proving to be.

Mozambique could well become a pacesetter in Africa. There are already a half-dozen African states espousing Marxist ideology to varying degrees, and Angola has also just announced its intention of establishing a similar vanguard Marxist-Leninist party later this year.

If Frelimo, Mozambique's ruling party, does herald the advent of a new African brand of communism, it is likely to be one steering its own independent course in foreign and domestic policy, just as the Eurocommunists are trying to do.

"We don't intend to become another Bulgaria here," said one adviser to Mozambique President Samora Machel, "and we certainly don't want to get involved in bloc politics."

Machel's strategy seems aimed primarily at balancing Soviet bloc presence here against the combined strenghts of the Eurocommunist parties, the European and Scandinavian Socialist and China, in order to preserve Mozambique's independence from all the superpowers.

The establishment of an overtly Marxist-Leninist party patterned after those of the Communist world has marked a sharp turn to the left for Machel personally.

His and the party's big iedological move came at Frelimo's party congress that ended Feb. 7. It was the third congress for Frelimo, the nationalist movement during this country's struggle for independence from Portugal and now its only political party, but only the first since Mozambique achieved independence in June 1975.

The main task of the five-day gathering of more than 300 delegates was to convert Frelimo from a wartime nationalist front into a political party capable of transforming this strategically located land of 9 million people into a "hard and pure" Marxist-Leninist state.

Stretching 1,700 miles along the Indian Ocean with a number of excellent natural harbors and well-equipped ports, Mozambique has rapidly become a country of intense interest and budding competition among the superpowers, China and the Soviet Union.

In many ways, Mozambique, with its strong Marxist leaning, fiery rhetoric and deep commitment to other African nationalist struggles, is reminiscent of Algeria at its independence 13 years ago. There, Arab nationalism eventually prevailed over Marxism. Here, the reverse may well happen, with Marxism incorporating Frelimo's nationalistic fervor in some new strain of Communism "made in Africa."

In any case, there is a coterie of highly intellectual and unquestioningly committed Marxists around Machel that is having an enormous influence and seems determined to make of Mozambique Africa's first authentic Marxist-Leninist state.

This group includes Marcelino dos Santos, the No. 2 figure of the government and minister of planning and economic development; Jorge Rebelo, minister of information and propaganda, and Jose Oscar Monterio, the party's secretary in charge of organization.

Whether Machel is leading, or being swayed by, this Marxist faction is the subject of much speculation in Western circles here. But there is general agreement that his power is undisputed, his top lieutenants appear loyal and the opposition to his rule is "grossly exaggerated" in the Western and South African press.

Machel has long been regarded as a Maoist and some Mozambicans say he is still far more pro-Chinese than pro-Soviet in his basic ideology. But until recently, the 44-year-old revolutionary did not pepper his speeches with the Marxist slogans and analysis that so strongly marked his nine-hour peroration to the congress.

His decision to adopt Marxism-Leninism as the part's guiding ideology reportedly evoked debate and opposition before the congress. Following a Central Committee meeting three days earlier, huge portraits of Marx, Lenin and Engels put up on one of the city's main boulevards were mysteriously taken down and portraits painted on walls in the industrial quarters were whitewashed.

But there was not the slightest indication of dissent during the congress itself carried off to the constant chant of "Viva Marxism-Leninism," mixed with "Viva Samora Machel."

With peasants, women, youth and workers parading in and out of the congress hall and with delegates bursting into African and Frelimo songs, it was a colorful occasion providing a strange mixture of Marxism and African culture.

"It's a carbon copy of our theory of a Marxist state," said one Eastern bloc journalist.

A Mozambique party theorist explained it differently. "It's the outcome of a natural evolution inside Frelimo that began years ago during our independence struggle and has nothing to do with copying a foreign model," he said.

After fighting 13 years to gain freedom with Portuguese domination, Frlimo leaders have shown no interest in yielding any Mozambique sovereignty.

Reports in the South African press of a Soviet air and naval base on Bazaruto island off the Mozambique coast infuriated the government and it flew Western diplomats over the island to prove the reports were false.

Machel is reported to have firmly rejected persistent Soviet entreaties last year for formal port facilities. He has apparently consented, however, to allow Soviet warships to visit Mozambique ports. A destroyer spent a week here just before the congress.

Whether Mozambique will go so far as to sign a 20-year friendship treaty with Moscow, as Angola did last year, should become clear shortly. Soviet President Nikolai Podgorny is scheduled to visit here in March.

Machel seems to have carefully avoided such an overt alignment with the Soviet bloc, partly, it is said here, out of a concern not to provoke South African into an open, active opposition to his regime. Furthermore, Frelimo is under no obligation to the Soviets as is the Angolan ruling party, which won its civil war in Angola against pro-Western factions last year thanks to the Soviet-supported Cuban intervention.

At the Frelimo congress, Machel indicated Mozambique's desire to have close relations with the Euro-Communist parties by inviting all of them and giving those who sent observers a very warm reception. Alvaro Cunhal, leader of the Portuguese Communist Party, received a hero's welcome.

Not all of Europe's Communist parties showed up or even bothered to reply to the invitation. The absence of the French Communists was particularly noted and neither the French Socialist nor the British Labor parties came.

China, whose popularity has waned here since its failure to support the Popular Movement to Liberate Angola during that country's civil war, was also absent reportedly because of political turmoil at home, although it did send a message of support.

Meanwhile, the Communist parties of the Soviet bloc turned out en masse, led by the East Germans, Soviets and Cubans.

After the congress, Frelimo signed its first economic, cultural and political accord since becoming a Marxist-Lenin party. It was with East Germany.

The Soviet bloc countries are assisting with advisers, technicians, arms and assistance in party organization. But the bulk of outside economic and financial assistance is so far coming from the West, notably the Scandinavian countries, Britain and the United States.