With Rhodesia attacks on the upswing, disident groups more active and the economy still deep in the doldrums, Mozambique's Marxist leadership is undergoing its severest testing since independence in 1975.

Yet the resolve of President Samora Machel and his government to see the nationalist guerrilla struggle in Rhodesia through to final victory, no matter the cost to Mozambique, seems stronger than ever. Equally strong is their determination to establish here the first Marxist "people's republic" in southern Africa against all economic and political odds.

The Rhodesian bid to break Mozambique's will to back the black nationalist cause and to arouse opposition to Machel's government by escalating the war insde Mozambique has failed so far.

Waht the Rhodesian ground and air attacks are doing, however, is to increase Mozambique's dependence on the Soviet Union and Cuba for military assistance, even as the economic crisis is driving the country to deal more with South Africa and Western countries, including the United States.

It has been 14 years since this Indian Ocean country of 10 million persons, twice the size of California and similar in shape, has known peace. After a decade of guerrilla warfare to throw off Portuguese-rule, it has become incresingly entangled in the Rhodesian nationalist struggle since Mozambique's independence four years ago this June.

In these first trying years, Mozambique has also been hit by devastating floods, drought, a giant hailstorm and a cyclone. Another drought appears to be in the offing this year.

While reeling from one natural disaster to another, the government has also had to cope with the flight of 250,000 Portuguese which flattened the economy and the arrival of 100,000 Rhodesian war refugees.

The latest challenge to Mozambique's Marxist rulers is what is taken here as a Rhodesian-inspired campaign by Mozambican dissidents to "destabilize" the government and bring an end to the people's republic.

In the past nine months, there has been more opposition activity than at any time since independence, principally in central and northwestern Mozambique, where the Rhodesian-armed group known as "Free Africa" has sent in small guerilla bands on hit-and-run attacks on roads, rail lines, farms and army convoys.

Another group, the Mozambique National Resistance, is active in the south, including the capital where it set off a big bomb last July in a downtown cafe, injuring 50 persons.

Despite the publicity these dissident groups are getting in the South African and Rhodesian press, they do not seem to be regarded by outsiders here as a very serious threat to Machel's closely knit government.

"The opposition is not uinted or working together and doesn't add up to much at this point," remarked one Western diplomat. "I wouldn't exaggerate its importance."

Visitors in Maputo during the recent conference of nonaligened nations saw no sign of any overt opposition activity, although stories abound about the difficulties foreign aid personnel are having in the north as a result of Rhodesian and dissident attacks.

What was perceptible was a slackening of popular enthusiasm at a mass rally during the conference in support of thw southern Africa liberation movement. Whether this was due to a public disenchantment with the government or simply exhaustion from five housr of standing in a hot sun was not clear. A smaller rally in the railroad yards a few days later was far more enthusiastic.

The continuing problems here could explain a drop in the barometer of general enthusiasm. People still line up for such staples as potatoes, rice, meat and cooking oil. According to the local press, lines are particularly long in the capital because its population has doubled to around one million since independence.

But restaurant menus carry a wider variety of dishes than a year ago and more restaurants are open, suggesting that distribution of available food is improving.

The basic indices of the economy remain grim, however. There is a desperate search for foreign exchange to compensate for the loss last April of $60 million to $70 million from a preferential financial arrangement mozambique had with South Africa. This "invisible" earning equalled nearly half the country's total exports in 1977.

South Africa used to pay a portion of salaries of Mozambicans working in South African mines in gold valued at the old official rate of $42 an ounce. This allowed the government here to resell the gold at world prices five times as high.

A continuing drop in prices of Mozambique's principal exports -- cashew nuts, cotton and sugar -- contributed ot a trade dedicit of around $300 million last year.

The government seems to be pinning its hopes on a natiowide mineral hunt now underway. Two American companies, Texaco and Union Carbide, were invited to participate. They sent investigation teams but neither has yet made a decision.

Large coal reserves, indications of sizable gas and some oil deposits off the coast and the discovery of iron ore, tungsten and several rare minerals on the mainland give hope that Mozambique eventually may become a lot richer. But there seems to be no immediate elixir for its economic woes.

Mozambique traditionally depended on the export of its crops such as cashew nuts, sugar and cotton, to earn its foreign exchange.

Now, however, its export earnings have declined drastically with the drop in the production of these cash crops. Due to the flight of Portuguese farmers after independence and marketing problems, Mozambique was struggling to meet half its international sugar quota of 85,000 tons last year and the cashew crop was down to about a third of the peak per--n-dependence level. Only tea and seafood exports have picked up in the past few years.

The transit trade appears to be the most promising offset to declining agricultural production. South Africa and Mozambique, despite their irreconcilable political differences, are doing more business together. They reportedly have worked out a five-or-seven-year deal whereby South Africa would increase substantially its use of Maputo port and Mozambique would upgrade its harbor and rail facilities.

Meanwhile, despite the fear among Mozambique's leaders of entangling ties with Western financial institutions, they have quietly negotiated several loans from American and Japanese banks. They also may soon join the European Common Market's Lome Convention economic pact that would make Mozambique elgible for tens of million of dollars in economic assistance from Western Europe.

The U.S. Export-Import Bank is helping Mozambique to purchase 25 General Electric diesel locomotives, manufactured in Brazil and costing $17.5 million. The government here is also negotiating with Washington for a long-term loan to buy large quantities of wheat, corn and rice.

Last year, Mozambique had to import 340,000 tons of grain. The officially estimated need for this year, 266,000 tons, is regarded as low by Western economists here.

Although deeply suspicious of such Western institutions as the World Bank and the International Monetary Fund, the Marxist government here has not hesitated to deal with American banks such as Citibank and Morgan Guaranty.