"Return to normal" boasted a government controlled newspaper yesterday as if to help Tunisians recover from the shock of the bloody midweek riots that were the worst the country has experienced since France granted independence in 1956.

Yet despite a relaxed curfew, sporadic small arms fire last night was evidence that something very basic has gone awry in what used to be called the most advanced and tolerant Arab or African nation.

With at least 40 dead officially acknowledged - and perhaps five times that number rumored dead - Tunisians are wondering whether their country is going to follow Lebanon into mindless self-destruction.

Only months ago Tunisia seemed ready for political pluralism, with opposition newspapers authorized and opposition parties rumored imminent.

Fueling the Tunisans' present anguish is the lack of precise official information since the government Thursday night decreed a state of emergency after a "premeditated" labor union general strike that degenerated into rioting in and around the capital and in some provincial centers.

Why, for example, has nothing more been said since Friday about the exact death toll? And why, Tunisians asked, did the government wait until last night to announce the arrest of Habib Achour, the leader of the General Union of Tunisian Workers?

But beyond such immediate concerns lies the depressing knowledge that the riots constituted the latest and most serious chapter in the continuing struggle for President Habib Bourguiba's succession.

The rioting has ended Tunisian's optimistic belief that theirs would be the first Third World society to enjoy a peaceful transition from the reign of the prototype nationalist leader turned founding father to a system based on firm institutional bases.

For most of the 1970s, Bourguiba, 74, has suffered from a debilitating form of anteriosclerosis. It has gradually deprived him of much of the clarity of political vision and vigor which had made him one of the most efficiently reform-minded Third World leaders and a favorite for lavish American aid granted as a reward for his pro-western moderation.

"His political base has been shrinking since 1970," said an opposition politician. "But shooting his own people for the first time has deprived him of his popular backing. Not even the French colonialists ever did anything on this scale."

Perhaps more to the point in this small country, whose political elite has scarcely changed since independence, the riots have crystalized genuine disgust with the clan rivalries that are held largely responsible for preparing the violence last week.

One clan is headed by Hedi Nouira, the prime minister, legal heir to the presidency and a politician bedevilled by a lackluster economy.

His clan includes Defense Minister Abdullah Farhat; Mohamed Sayah, leader of the country's only party called the Destour Socialists, and the president's son by his first marriage, Habib Bourguiba Jr.

Another clan involves Achour Bourguiba's influential second wife, Wassila, and Mohamed Masmoudi, a former foreign minister recently returned from self-imposed exile after failing to conclude a controversial federation with Libya three years ago.

For most of the past 12 months, Achour's union has challenged Nouira's authority by contesting a five-year government pay freeze and pressing for greater liberalization and freedom of expression.

In Decemebr Nouira fired Interior Minister Tahar Belkhodja, an Achourally who has veered from being a law-and-order hard liner toward increasing liberalism.

Nouira's authority suffered another setback when five ministers resigned in protest against Beklhodja's dismissal.

But diplomats and some Tunisians are convinced that Achour walked into Nouira's trap when he suddenly called a nationwide general strike on Thursday with little more than a week's preparation.

His partisans claim Achour had little choice since the government was about to deprive him of leadership - a fate whivh he himself visited upon his predecessor in 1966.

Since the riots Nouira has shown his hard-line tendencies by warning he wuld deal with "all those who are hiding behind democracy and are the real rioters." Following Achour's arrest - and the probability that his top dozen collaborators have also been detained - a political trial is likely.

Judging from the number of resignations and expressions of guilt emanating from union leaders across the country, the government apparently is determined to install alternate leadership.

In any case, it would be an excellent tactical move to reduce the half million strong labor union to an empty shell. The organization long ago ceased to be more than a rubber stamp outfit capable of little more than sending telegrams to the leadership.

But in retrospect Achour's willingness to allow leftists and ultraleftists into the union - the only Tunisian institution where they were welcome - may now be used by the government as proof of his subversive intentions.

By midweek it appeared both government and union leadership were on a collision course despite efforts by moderate opposition leader Ahmed Mestiri to find a last-minute compromise.

Yet even the most Machiavellian Tunisians appear convinced the situation got out of control in sorcerer's apprentice fashion.

One heart-broken, middle-aged manager said, "Pity the country where one side uses the army and police and the other the urban rabble."

Opposition leaders privately insist the government used agent provocateurs to fire on the police and army troops rushed in to help control rampaging demonstrators.

Eyewitnesses reported seeing machine guns and other automatic weapons used indiscriminately by army troops manifestly untrained in riot control.

Other eyewitnesses said many demonstrators were teen-agers, and their random violence reflected more a spontaneous urban uprising than fulfillment of any apparently carefully thought out plan.

Especially worrying to conservative Tunisians was the knowledge that many victims were children of the outlying slums, the dispossessed in a society where average annual income is about $1.000.

The rioters seemed to prefer a targets either symbols of office authority such as party offices, or of consumer society in form of bank, fancy applican stores or the more expensive the makes of automobiles.

Conservatives began to see the dangers of having the highest literacy rat in Africa in a country where two-thirds of the population is under 20 and tempted by watching Italian television, hearing French radio programs and mixing with well-heeled European tourists who arrive by the millions.

Nouira and his Hard-line supports have come out on top, many local observers are convinced his may be a phrrhic victory.

"It's far from over," a Tunisian said. "And it looks like the choice is between fascism African style or democracy. And democracy means more blood because you end up paying for everything worthwhile in life.

"We live on a kind of mythology in which Bourguiba is the fount of all wisdom. We are prisoners of that myth just as the president is prisoner of his illness.

"If we had any courage, we, the elite, would demonstrate in the streets against what is happening," he said wistfully, "but we are paralyzed and cowards."