President Houari Boumediene of Algeria, who died yesterday at Mustafa Hospital in Algiers, was a puritanical soldier who sought prosperity and renewal for his people through socialism and Islam.

He had been ill for three months with Waldenstroem's disease, a blood disorder that causes disintegration of bone marrow, the kidneys nd other organs. He had been in a coma for 40 days at the time of his death and at various times had been attended by phsicians from the United States, the Soviet Union-where he underwent five weeks of hospitalization in October and November-Eruope, and Cuba.

But it was only on Nov. 18 that the tightly controlled Algerian news media made its first reference to his failing health by announcing that the regularly scheduled Sunday Cabinet meeting had been cancelled. Since then there have been only brief reports that Boumediene remained unconscious.

Thus the final weeks of this enigmatic and visionary man were shrouded in the same air of mystery that cloaked much of his life. Not even his age was publicly known-the year of his birth has been reported variously as 1925, 1927, 1930, 1932 and 1934. According to an account based on an interview with his father, he was 46.

For algeria, his death means the loss of a leader who retained the esteem and respect of his countrymen through 13 years of rule. He brought a measure of order and progress out of the chaos that followed a cruel war of independence. Although the economy has slowed and unemployment and inflation are high, the country has enjoyed growth rates as high as 11 percent in some recent years. The price of stability has been sharp curbs on the political process and it may be sometime before a successor emerges. Likely candidates, in the view of some U.S. experts, are Foreign Minister Abdelaziz Bouteflika and Interior Minister Ahmed Benahmed Abdelghani.

For the part of North Africa known as the Maghreb, Boumediene's passing leaves King Hassan II of Morocco as a leading power. The moroccan Army has been fighting the Algerian-backed guerilla front known as Polisario in western Algeria for the past two years. Many Algerians have blamed their economic difficulties on the war and Hassan said in an interview in Washington last month that he believed that any successor to Boumediene would be less interested in continuing the conflict.

On the question of who would take the Algerian leader's place, the king said he doubted that it would be either Bouteflika or Abdelghani.

For the world, Boumediene's death means the loss of an advocate of using Arab oil and other resources as an economic and political weapon on behalf of the Thrid World. He expressed these ideas at the 1974 special General Assembly of the United Nations on the economic problems of the Third World. It was Boumediene's first trip to a Western country and it secured his place as a major spokesman for Third World interest. He took the occassion to visit then-president Nixon in Washington.

Boumediene's death also means the loss of one of the most outspoken and intransigent Arab supporters of the Palestine Liberation Organization. He was a foe of negotiations toward peace between Israel and Egypt so long as these moves were opposed by the Palestinians. For Boumediene, the Arab struggle against Israel was part of a larger struggle against "imperialism."

In his dealings at home and abroad, Boumediene was a pragmatist as well as an ideologue. He maintained that Algeria must be Arab and Moslem "whatever the price, because for us it is a question of life and death." Yet France, the former colonial ruler, remains Algeria's main trading partner. Thousands of French citizens have served as teachers and technicians in Algeria while an estimated 1 million Algerians have emigrated to France, where they eke out a meager living doing menial work. French and other holdings in Algeria were nationalized.

Boumediene broke diplomatic ties with the United States after the Six Day War in the Midle East in 1967, and they were not restored until 1974. Yet by that time the United States had become a major buyer of Algerian natural gas. By the same token, Boumediene has taken industrial goods and technical aid from the Soviet Union and Soviet Bloc countries while buying similar assistance in the West. He once commissioned both the World Bank and the Soviet planning agency, Gosplan, to carry out simultaneous economic surveys in Algeria.

His concepts of economics and religion overlapped and the words "socialism" and "Islam" were almost synonymous to him.

"Islam is not only a spiritual path but a social and political program," he said. "It represents the very foundation of Algerian society. It exceeds all other religions in equality and in its struggle for the liberty of man."

Boumediene first came to power, although not to wide public attention, in Algeria's war of independence against France. For the last two years of the conflict, which lasted from 1954 to 1962, he was chief of staff of the army of the National Liberation Front with the rank of colonel, the highest in the service. The army remained a touchstone of his power.

While all leading Algerian political figures began as members of the independence movement, Boumediene differed from most in one profound respect. He was an Algerian and an Arab in upbringing, education and culture and not an Algerian brought up as a Frenchman.

Whereas Ahmed Ben Bella, the great popular hero of the war and Algeria's first president, was fluent in French but not in Arabic, Boumediene thought and spoke in Arabic and was less at home in French. This gave him a tie with the common people that was another touchstone of his power.

When Algeria gained its independence in 1962, the National Liberation Front began to show signs of falling apart. The provisional government was headed by Benyoussef Ben Kedda, a leader of the "centrist" faction that bad dominated the government-in-exile in Tunisia. Boumediene was angered by the privileges Ben Khedda took and joined Ben Bella, who had spent most of the war as a prisoner in France, in setting up a rival center of power.

Elections in September 1962 ended the factionalism for the time being. Ben Bella's group won 90 percent of the vote and he became premier. Boumediene was named minister of defense. In May 1963, he was named first vice premier. In September 1963, Ben Bella was elected to a five-year term as president.

The collaboration between Boumediene and Ben Bella lasted less than two years. Ben Bella wished to sub-ordinate the army to the civil power. Boumediene wanted the army to play an equal part in the government. Ben Bella launched his own campaign to become a leader of revolutions in the Afro-Assian bloc. Boumediene was concerned about the worsening situation at home.

In May 1965, Ben Bella tried to force the resignation of Bouteflika, a close colleague of Boumediene, as foreign minister.The following month, as Algeria was preparing to host an Afro-Asian conference, Boumediene learned that Ben Bella was trying to dump him as well.

He was quick to respond. With the backing of the army, he seized the presidency by overthrowing Ben Bella in a bloddless coup on June 19, 1965. On July 5, he formally assumed the presidency of the ruling revolutionary council.

Boumediene's ascendency was due mmore to his skill as an organizer-and to bickering among other members of the National Liberation Front-than to his important but largely unpublicized role in the revolution. So far is he from the charismatic mold of ladership that he has been called "the Sphinx of Algiers."

He was born in Clauzel, a village near Guelma in eastern Algeria. The date was Aug. 23, 1932, according to an interview his father, a small wheat farmer, gave in 1965, and his name was Mohammed Ben Brahim Boukharouba. The young Mohammed was said to be one of seven children.

At the age of 6, he was sent to Koranic school in Guelma and remained there until he was 14, studying Arabic and religion. He later attended one of the few Arabic secondary schools in the country at the time. It was located in the city of Constantine, and there he did all his studying in Arabic.

In 1952, according to several reports, he left the country to avoid being drafted into the French Army for service in the war in Indochina, and went instead to Cairo. There he enrolled in the famous Al-Azhar University, Islam's great seat of learning.

He was in Cairo when Col. Gamal Abdel Nasser and a group of army officers overthrew King Farouk and started the Egyptian revolution. It was also in Cairo that he first met Ben Bella and several other future leaders of the Algerian independence movement. And it was in Egypt that the future chief of staff of the army of the National Liberation Front got his first military training. It was at a camp at Hilwan.

By 1957, he had taken the name of Houari Boumediene as an nom de guerre and assumed command of the military effort against the French in western Algeria. A year later, he took over Algerian training bases in Morocco. In 1960, he was named chief of staff of the army with headquarters in Tunisia. Even though he was out of combat zone, he directed operations throughout Algeria and at the same time built up the training and efficiency of the army.

His methods were uncompromising. In 1959, he executed three colonels, four majors and a captain suspectd of collaborating with the French.

In person, Boumediene was of medium height, gaunt, pale, red-haired, and possessed of remarkable green eyes. A Frenchman once said of Boumediene's eyes, "They hint of something deeper than cold passion. They made me afraid." It is said that he was embarrassed by bad teeth until a French dentist fixed them.

He was a chain-smoker and drank large quantities of coffee. For years there were rumors that he had been married and divorced, but colleagues said that "his only wife has been the army. (It was reported later he married an Algerian lawyer named Anissa in 1973). He enjoyed chess.

When he took power from the erratic Ben Bella, he continued to live for sometime in a simply furnished room in an army barracks.

Boumediene's first task on assuming the presidency was to try to bring some order to the economy and administration. His aim was to transform an agrarian society into an industrial one. The plan was to use Algeria's oil and natural gas reserves as a basis for industry that would provide work for the vase population of unemployed. As industry grew, investments would be made to irrigate the arid countryside.

Despite progress, the old problems persist. The population has doubled to more than 17 million sice independence, so the number of unemployed has increased. At the same time, expectations - whetted by French and Italian radio and television broadcasts with their depictions of the good life in Europe-have risen.

When oil prices increased fourfold after the Yom Kippur War in 1973, many Algerians wondered why they were still expected to live in austerity. The younger generation, with no memories of the war in which estimates of the number of Algerians killed ranged from 250,000 to more than 1 million, were particularly impatient.

Just how impatient became clear in 1976 when Boumediene lifted strictures on political debate for the first time. The purpose was to give the people an opportunity to comment on a charter that would form the basis of a new socialist constitution in which the National Liberation Front would be the only legal party.

The criticism ranged far beyond the charter. Boumediene's policies were criticized, as were some of his high-living colleagues. Boumediene reportedly told a labor congress that he would resign if the country no longer wanted to follow him.

But the charter was ratified in a national referendum. A new constitution was approved and a new National Assembly was elected for the first time since 1962.

In December 1976, Houari Boumediene-who used to explain that "our socialism is without philosoph. The underprivileged classes have to benefit from our revolution. That is our only criterion"-was elected to a five-year term as president.

He was the only candidate on the ballot.