President Samora Machel disclosed yesterday that his government was cutting back sharply on its pervasive role in the country's economy.

Machel called on the thousands of small industrialists and shopkeepers who fled the country at the time of its independence in 1975 to return and take over businesses again. Since their exodus, the enterprises have been run by the government with indifferent success.

In a 4 1/2-hour speech outlining radical changes in Mozambique's heretofore rigidly Marxist economic policy, Machel also said that in the future nationalized industries will be expected to make profits and that prices to farmers will be increased. Essential consumer goods will be rationed in the larger cities, he said.

Mozambique gained independence from Portugual with a minimum of violence but the exodus of 250,000 Portuguese who dominated trade, comdisrupted the economy.

With foreign exchange earnings dependent mostly on sales of cashew nuts in the West, the Machel government has steadily strengthened ties to the United States as well as South Africa, while maintaining its firm ideological allegiance with the Communist Bloc.

Despite aid from the Soviet Bloc and Western Europe, the economy has remained stagnant. It was further damaged by punitive raids from Rhodesia against guerrillas harbored here during the just-ended war in the neighboring country.

Machel interrupted his speech yesterday to sing, whistle, tell jokes and compliment ministers on their clothes. Yet the speech itself was serious and concentrated on issues of direct concern to his audience of 50,000 in Independence Square: economic problems and long lines at shops. Indeed, the biggest applause was for the simple announcement that no one, not even the military, was to have priority in the lines.

Machel stressed that Mozammique is still committed to socialism. "The state must involve itself with large development projects and the major social sectors of education, health, housing, and justice," he said. "The state should not sell matches."

This represents the most dramatic change in policy. Previously Mozambique was committed to maintaining all of the shops and industries that existed at independence. So when thousands of shopkeepers and other businessmen left, the new government just took over. There are state-run bars, restaurants, boutiques, shoemakers, hairdressers, and garages.

Many run well. But the food and clothing shops put together into a national chain of "people shops" have failed. Those who run them are paid more than nurses, Machel noted, but do little to find goods to sell. Their shops are often empty while neighboring private shops have goods for sale.

Some small businesses, including some "people's shops," will be returned to private ownership, Machel said. He added that 10,000 Mozambieans in South Africa, Swaziland and Rhodesia wrote to say they wanted to return. He promised special incentives for them to come back and invest in shops, restaurants, farms and other activities.

Michel stressed that they must agree with Mozambique's socialist objectives but "the state will create the conditions to support private traders, farmers, and indurstrialists. Private activity has an important role to play in straightening out our country."

If the "people's shops" were a mistake, cooperatives have proved to be much more effective -- probably because much of the organization is done by local residents rather than by civil servants. Thus many of the people's shops will be turned over to cosumer co-ops. Any not wanted by private traders or the co-ops are to be closed.

The economic shakeup comes after a two-month offensive against incompetence, negligence, and corruption that led to more than 100 arrest.