More than 40 people were killed today in the fifth straight day of heavy fighting in Lebanon's northern city of Tripoli, police reported. It was the highest death toll in seven weeks of sporadic battling between pro- and anti-Syrian factions.

Beirut radio and television said residents in many neighborhoods were huddled in their homes and shelters without water or electricity and that food supplies were dwindling fast as the fighting engulfed the entire city.

Syrian troops stationed in and around the city as part of the old Arab peace-keeping force were reported to be using heavy artillery to shell districts of the city where anti-Syrian groups are based. Some reports said shells were raining indiscriminately on other parts of the city as well.

The intermittent fighting there has dragged on for almost two months despite several attempts by high-ranking Syrian delegations to negotiate a cease-fire among the feuding factions and restore peace in a city dominated by Syrian forces.

The death toll in Tripoli, Lebanon's second largest city with a population of half a million, is estimated now at between 140 and 180 persons with hundreds of others wounded.

Like the Israelis in the mountainous Chouf region southeast of Beirut, the Syrians have encountered enormous difficulty in bringing the renewed outburst of strife among Lebanon's multitude of sectarian and political factions under control.

The strife both in the Chouf and Tripoli has grown steadily worse in the absence of any progress in American-sponsored efforts since early last fall to get negotiations under way between Lebanon and Israel on the withdrawal of all foreign forces from this war-weary country. The two governments are now finally holding meetings but after three sessions they have yet to agree on an agenda.

While the fighting in Tripoli has posed no threat to Beirut, it has become a major concern of the Lebanese government because of its potential for sparking trouble elsewhere.

Prime Minister Shafiq Wazzan yesterday telephoned his Syrian counterpart, Abdul Rauf Qasim, and appealed to him for "some Syrian security measures to help end the tragic situation" in Tripoli.

Today, Rashid Karami, a former Lebanese prime minister and a leader of the predominant Sunni Moslem community in Tripoli, went to the Syrian capital to discuss the worsening situation. The Syrian foreign minister and defense minister already have visited Tripoli to try to arrange a settlement.

Anti-Syrian factions in Tripoli have been calling for the withdrawal of Syrian troops from the city. Mohammed Ali Dannawi, head of the Moslem Salvation Front, appealed to Karami yesterday "to take a courageous step and ask Syria to withdraw its forces from Tripoli."

Another anti-Syrian militia leader, Farouk Makaddam, accused the Syrian Army of carrying out a "bloodbath" and "piecemeal massacre" against the residents of Tripoli.

It is far from clear, however, that the withdrawal of Syrian troops would end the fighting, since pro- and anti-Syrian Lebanese factions in the city seem determined to have it out in their struggle for dominance over political life there.

Just how the latest round of fighting started is not clear. Correspondents attempting to reach the city 50 miles north of here today found the road cut by Christian militia forces just south of Tripoli.

The Syrians have succeeded in arranging several short-lived cease-fires during the past month but no basic solution to the strife appears in sight there or in the Chouf, where Christian and Druze militias are at war.

Today, the Beirut press reported that another Israeli-brokered cease-fire had come into effect in one part of the Chouf around Alayh, along the Beirut-to-Damascus highway. Whether this one will hold any better than the others the Israelis have tried to impose remains to be seen, but there was little optimism among outside analysts that it would last in the absence of any underlying political agreement between Druze and Christian leaders.

Well over 100 other persons have died in the Chouf since the fighting broke out there in mid-October.