Thousands of Algerians poured into th sheets today to mourn the death of President Houari Boumediene, the staunchly anti-Western Thrid World leader.

The Algerian government, promising to continue his 13 years of "socialist revolution," named Rabah Bitat, president of the Popular National Assembly, as interim president for up to 45 days. It declared 40 days of official mourning.

Boumediene's death early today came after he lay 40 days in a coma with a rare blood diseas.According to the best information available, Boumediene was 46 years old.

President Carter, expressing deep regret, said in a statement that Boumediene "played an outstanding role in Algeria's long struggle for independence. His devotion to duty and his contributions as an international statesman are well known. But it is for his efforts to help create and strengthen an independent, self-sufficent Algerian nation that he will be most remerbered.

The Soviet press hailed Boumediene as "a gret friend of the Soviet Union" and said he had "made a great contribution to Algeria's social and economic progress."

Despite their public quarrel over Middle East peace policies. Egypt's President Anwar Sadat paid tribute to Boumediene and said he received the news of his death "with sorrow and sadness." Despite the break in deplomatic relations between the two countries, Egypt decided to send a delegation to take part in Boumediene's funeral.

Immediately after the Algerian state radio broadcast news of Boumediene's death, downtown Algiers became jameed with demonstrator paying homage to the fiery nationlist who seized power from then-president Ahmed Ben Bella in 1965.

An estimated 2 million algerians, many of them weeping, gathered outside the Palace of the People, where the body will lie in state in the Grand Salon of Officers o f the Algerian army. There was no immediate announcement of the timing of the planned state funeral.

Bitat convened a session of the National assembly, Boumediene's rubber-stamp parliament, and eulogized Boumediene as a "brother in combat" and a "great statesman."

Bitat, also a revered independence fighter, assured the assembly he was totally committed "to the irreversible course of socialism, national independence, economic progress and justice" in this oil-rich nation of 18 million people. Th constitution does not allow Bitat to run for president.

The eight-man Council of the Revolution will choose a new president for this predominantly Moslem cournty, which Boumediene's iron-willed leadership - and Soviet aid - raised from a largely agricultural nation to one of the most developed nations in the Third World.

The army has vowed its "unshakeable support" for Boumediene's "socialist revolution" and rebutted any suggestion a change of leadership might alter Algeria's position of backing the Polisario guerrilla movement. Te Algeria-based guerrillas are fighting neghboring Morocco and Mauritania for possession of the former Spanish Sahara.

The government frequently has reaffirmed it support for the Polisario and stepped up its propaganda campaign against Morocc, accusing it of exploiting Boumediene's illness to undermine Algeri's stability.

In Rabat, Morocco's state radio broadcast a message extending "a fraternal hand to the new Algerian leaders" but did not mention Boumediene at all.