TRIPOLI, Lebanon (AP) _ Tens of thousands of mourners chanted the Moslem invocation ''There is no God but God'' today at the burial of assassinated Prime Minister Rashid Karami.

Karami's coffin was lowered into the grave in Tripoli cemetery next to that of his father, Abdul Hamid Karami, who was prime minister in 1945. A Lebanese army artillery battery fired a 21-gun salute.

Karami, 65, a Sunni who was Lebanon's longest-serving prime minister, died Monday when a bomb blast tore through his military helicopter as he flew from Tripoli to Beirut.

Church bells and the reciting of the Koran echoed across Lebanon's second largest city as the funeral procession marched slowly toward the Mansouri mosque for prayers. After the prayers, Karami's coffin - draped in the Lebanese flag - was taken to the cemetery on the same gun carriage that brought it from his home to the mosque.

Four Lebanese army officers escorted the gun carriage bearing the coffin as a police band played the national anthem and the death hymn. A half-dozen white-turbaned Sunni Moslem clergymen followed behind, reciting verses from the Koran, Islam's holy book.

Three policemen carrying wreaths of flower from Syrian President Hafez Assad, Lebanese President Amin Gemayel and Parliament Speaker Hussein Husseini led the funeral procession followed by hundreds of wreath-carrying boy scouts, an army platoon and the jeep-towed gun carriage.

Newly appointed Prime Minister Salim Hoss, Syrian Vice President Abdul Halim Khaddam and Husseini marched behind the Moslem clergymen followed by about 25,000 men mourners. Islam's Sharia law bans women's participation.

Karami's assassination shocked a nation that has suffered more than 125,000 deaths in its 12-year-old civil war.

In Tripoli, a port city 50 miles north of Beirut that Karami represented in Parliament for more than three decades, a black placard at the city's entrance read: ''Tripoli Is In Grief.''

Karami had been prime minister 10 times in 32 years and was a staunch backer of Syria, the main power broker in Lebanon.

This morning, children carried wreaths of white flowers to Karami's home near the Mediterranean sea. Thousands of women wore black dresses and white scarves, traditional Moslem mourning clothes.

Syrian troops patrolled the streets and frisked mourners as they arrived in buses, cars and on foot for the funeral. Syrian armored personnel carriers crawled through the dusty streets, keeping order in the area that has been dominated by Damascus for a decade.

Hoss, a Sunni who represented Gemayel at the funeral, has vowed to find and punish the killers. But Lebanon's government institutions, including the judiciary, have functioned only sporadically since the war broke out in 1975.

Military officials and witnesses have issued conflicting reports on the bombing, which also inflicted minor wounds on four other passengers on the helicopter, including Interior Minister Abdullah Rassi.

Rassi disputed army officers' accounts that the bomb was concealed in Karami's attache case. He claimed the device was planted elsewhere in the French-made Puma helicopter.

Coroner Joseph Soto said he believed the bomb ''was planted behind the premier's seat.''

Justice Minister Nabih Berri, who also is leader of the pro-Syrian Shiite Moslem Amal militia, accused Israel and the right-wing Christian Lebanese Forces militia of killing Karami.

''Israel penetrates the Lebanese Forces, who control the area where the helicopter in which the premier was assassinated was parked before it flew to pick him up from north Lebanon,'' Berri said in a television interview Tuesday.

The Lebanese Forces denied the charge, saying in a statement that Syria policed the area from which the helicopter set out.

Syria maintains 25,000 troops in northern and eastern Lebanon under a 1976 peacekeeping mandate from the Arab League. In addition, on Karami's invitation, Damascus deployed 7,500 troops in Moslem west Beirut in February to quell factional fighting.

Karami was killed 28 days after he announced he was resigning because of the failure of his 10-member half-Moslem, half-Christian Cabinet to deal with a prolonged economic crisis. He refused to submit the resignation to Gemayel as required by the constitution, so it did not take effect.