Battles between Sunni and Shiite Moslem militiamen raged through the night and most of the day today in the streets of west Beirut, overshadowing at least temporarily a three-week-old fight for control of three Palestinian refugee camps in the southern part of the city.

Hospital sources could give only preliminary casualty figures in this heaviest fighting of the year in west Beirut, because rescue teams and firefighters could not get near the area. At least 20 persons were reported dead and 80 wounded with the number expected to rise. The death toll in the camps is reported to have reached more than 70, with about 750 wounded.

Shiite militiamen appeared to have the upper hand in the fierce inter-Moslem conflict in west Beirut. A Shiite Amal spokesman announced that its men had taken over the headquarters of a major Sunni Moslem activitist, Chaker Berjawi, who is sympathetic with Palestinian concerns. Amal spokesmen accused Palestinian guerrillas of joining the Sunnis in the fighting.

Syrian efforts to contain the crisis proved ineffective, and commentary in the local media said the conflict was an extension of hostilities between Shiite and Palestinians inside the embattled refugee shantytowns.

Large numbers of gunmen were present in residential areas in the Sunni Moslem Tariq Jedideh area, following fierce rocket and mortar duels that erupted yesterday and set buildings aflame. The fighting there threatened 2,000 children at a nearby orphanage and trapped much of the staff at the Maqassed hospital indoors.

"Two thousand children are in real danger and we will have a disaster on our hands if food supplies cannot be brought to the orphanage home and the siege around us is not lifted," said a statement from the orphanage, read over the Sunni-run Voice of the Homeland. "The children are terrified and there is a shortage of workers, medicines and relief . . . . We beg you to stop firing around us . . . in the name of humanity."

The fighting added to the sense of the city's slow slide into anarchy, which has drained it of many of its diplomats, international relief workers, bankers, doctors, journalists, and academics.

The atmosphere affected local gunmen as well. They opened fire with mortars and machine guns today at the slightest movement, even the fluttering of crows perched over the fresh bread spread out in front of the few bakeries that remained open.

Lebanon Prime Minister Rashid Karami and Education Minister Selim Hoss appealed to Syrian Vice President Abdul Halim Khaddam to stop the fighting and put an end to "Beirut's tragedies."

A Shiite Amal leader and South Lebanon Minister Nabih Berri requested that the Lebanese Army and police force move into the streets. However, attempts to approach trouble spots during the day were thwarted twice and one officer and three soldiers were wounded.

Berri warned militias against looting or "encroachment on private property of civilians," a catch phrase for the common practice of taking over vacant apartments after bouts of fighting. Aware of public opinion against militia excesses, Berri cautioned that any violators would be "punished by execution."

Witnesses in the Tariq Jedideh quarter said Amal, Syria's closest ally in Lebanon, was storming pockets of Sunni opposition following its seizure of Berjawi's headquarters. Private radio stations said the defeated Sunni leader had ordered his men to surrender their weapons to the pro-Syrian Lebanese Baath Party and militiamen of the Druze Progressive Socialist party of Walid Jumblatt.

Although battles abated in the evening, occasional blasts could still be heard. People stayed indoors fearful that the fighting would flare up again despite Amal's apparent grip over Tariq Jedideh.