Libya is considering a major change in its relations with Moscow, possibly including the establishment of Soviet military bases here at the strategic center of the southern Mediterranean, according to the No. 2 man in the Libyan government.

Staff Maj. Abdul Salaam Jalloud said at a press conference tonight that Libya has "not decided" on the question. But he said, "We are about to review our policies. If we are forced to take steps, then those who forced them should take responsibility."

Despite Jalloud's comments, it remained unclear whether Tripoli and Moscow could reach such an agreement given the considerable friction that periodically has marked their relationship in recent years.

In his rambling and repetitive 45-minute statement and then in response to questions, Jalloud sought to portray the American air raids here as a political and military failure and Libya as the victim of an unwarranted aggression. He described what he called the U.S. administration's efforts to kill Libyan leader Muammar Qaddafi as an "unprecedented" attempt by one nation to murder the president or leader of another.

Noting that American bombs were targeted at Qaddafi's Bedouin tent, his home and his offices at the installation where he lives, Jalloud said, "The tent has emerged victorious."

Qaddafi suffered no injuries, Jalloud insisted, but he declined to say where the Libyan leader was at the time of the strike.

Jalloud said that 37 persons were killed in the raids -- 36 of them civilians -- and that 93 had been injured.

Twenty coffins were buried today in a historic cemetery here, surrounded by troops from almost every faction of the Libyan security and military forces. Two of the coffins were draped with the flag of the Libyan Navy. After the main funeral was over, guns were fired in the air by some sailors burying their dead in another corner of the cemetery. Two more coffins were surmounted by flowered wreaths with the insignia of the antiaircraft corps.

The fact that Jalloud held the press conference instead of Qaddafi suggested that the Libyan leader is still concerned about his security. It also was read by some analysts as an indication that the radical Revolutionary Committees, rather than the relatively more conservative armed forces, have gained the upper hand here since the raid.

Addressing Secretary of State George P. Shultz's statement yesterday that an Army takeover here would be desirable and that its chances have grown since the bombing, Jalloud said flatly, "There is no possibility of a coup."

The five remaining members of the original revolutionary group that took over the country in 1969 and the Revolutionary Committees dominated by Jalloud "are Qaddafi," Jalloud said. "Who makes a coup against Qaddafi makes a coup against us.

"This is a dream of Mr. Shultz," Jalloud added.

He vowed that Libya would never give up its "principles" and said it would continue to support Palestinian and other "liberation movements." Narrowing his eyes to slits as he answered questions about three western hostages murdered this week in Lebanon, he denied any Libyan responsibility for the numerous acts of terrorism that have erupted since the American bombing here.

Jalloud stopped short of calls for vengeance, however. At times Jalloud, the leader of what is considered the most radically revolutionary faction of Qaddafi's power structure, seemed to be suggesting a cease-fire.

"If the attackers have withdrawn," he said, "the battles are over. He who starts the attack should stop it." Jalloud said that Tripoli has attempted to send messages through Moscow to Washington, but he did not elaborate.

Jalloud also talked specifically about the conditions under which Soviet bases might be allowed here.

He said that if Libya wins no condemnation of the U.S. attacks from the U.N. Security Council because of a U.S. veto, and if it continues to feel itself confronted by the combined strength of Washington's forces and the Atlantic Alliance, "it is well, now, after the world has not respected our neutrality, to take appropriate steps."

Although the Soviet Union is Libya's preeminent arms supplier and Eastern Bloc countries have sent key advisers in security matters, relations between Tripoli and Moscow often have been cool.

Qaddafi is thought by diplomats to be afraid to allow too much Soviet influence here, both because his fundamentalist Islamic views are opposed to atheistic communism, and because of the example of other countries, especially Afghanistan, where Soviet influence turned into Soviet control.

As a result, Qaddafi has refused to allow Soviet bases here and in the past year there has been discernible friction with Moscow over questions of Libya's payments on a military debt estimated at about $5 billion and Moscow's refusal last fall to sign a friendship treaty with Tripoli.

Some diplomats here whose countries have military ties to Libya believe that the unimpressive performance of the Soviet weaponry in the March confrontation with the U.S. 6th Fleet over the Gulf of Sidra and again Tuesday morning may have reduced Libyan confidence in Moscow.

A few western diplomats have claimed that the Soviets provided little or no intelligence to the Libyans during the Sidra incident and the extent to which Tripoli appeared to be caught unaware by the Tuesday morning raids suggests there was little concrete information here about what was going to happen.

The Soviet Union also refuses to acknowledge Libya's territorial claim to the entire Gulf of Sidra.

The withdrawal of a Soviet military ship from the harbor here before the raid on Tripoli was also thought by diplomats to be a point of resentment.

The Soviet ambassador was the first envoy to be received by Qaddafi following the raid, however, and the Libyan leader is reported to have given him a message to take to Soviet leader Mikhail Gorbachev.

An official statement by Libya's "revolutionary leadership" on Wednesday, perhaps reflecting some of the message's content, said "the socialist bloc, headed by the Soviet Union, should shoulder its international responsibilities in a real war waged by NATO against a nonaligned small people."

At today's funeral ceremonies, a crowd of 4,000 to 5,000 was addressed by Maj. Khuildi Hamedi, a member of the Revolutionary Council that originally helped Qaddafi take power. Wearing a red beret and green fatigues, he stood at one point among the coffins on biers outside a small, white mosque and raised the crowd's anger and emotion to a feverish pitch.

"Holy war, holy war," shouted a knot of uniformed onlookers, pressing in on each other and almost shoving him off the bier. "Unity, unity."

"We are not afraid of the Air Force of America. We are not afraid of the 6th Fleet. We are strong," Hamedi shouted.

Hamedi, like Qaddafi, vowed that Libya would fight on and stand firm in the face of U.S. attacks.

But even as he spoke, there was evidence of the kind of frictions among the forces here that many observers in Washington have cited as reasons to believe Qaddafi's regime may not be stable.

Some of the most conspicuous men in the crowds were unarmed military police in red berets, green uniforms and white belts and shoulder straps. The only arms borne in the crowd, and by men standing on the mosque's roof, were the Soviet-made AK47s carried by members of the Revolutionary Committees in civilian clothes or, at most, green fatigue jackets.

The scene suggested that the revolutionary guards remain Qaddafi's most trusted supporters and that some members of the military may have been disarmed during a period of dissension following the American air strikes.

Qaddafi did not make an appearance, but there is now strong reason to believe he remains in Tripoli. Videotape was shown last night on Libyan television of Qaddafi touring the Old Central Hospital, visiting those wounded in the American air raid. This morning, reporters were able to talk to two nurses who work at the hospital, who confirmed that they had seen Qaddafi there and that he appeared in good health.

Ambassadors from several nations, including Cuba, Syria, Sudan and Kuwait, attended the funeral, elbowing their way through the crowds to give their condolences to Hamedi and then attending the services as they moved into a large area near the entrance to the Al Hanni cemetery.

A bystander watching the services told reporters that this was the site of the first battle between the Libyans and the invading Italian colonial forces in 1911.One of the coffins was draped in both the flag of Lebanon and the flag of the Palestinians. On its side it bore the name of a young woman, Ritfaat Hussein, said to be a teen-ager killed in the bombing of the Bin Ashur residential district early Tuesday morning. The Syrian ambassador stood at the graveside of the Lebanese girl as she was buried.

The mood of the crowd was angry, but little of their aggression was turned toward the 60 or so foreign journalists among them. The main desire of bystanders in the crowd and of mourners seemed to be to find some sympathy from the westerners, some sharing of the grief that was felt at the site.

"The Libyan people never figured Reagan would make something like this," said a man watching the funeral from a nearby fire station.

Mohammed Abdelatis, a clerk and the uncle of one of the dead buried today, 20-year-old Abdel Akhim Sadiq ben Abdelatis, said as he stood with red-rimmed eyes by the graveside, "I am happy. He has died for the Revolution, for the Jamahariya. We are ready to do anything for Libya."

The coffins were lowered into the small tombs made of concrete block and sealed over with paving tiles, then cement. One man, smoothing down the concrete on the top of a newly made grave, looked up at a journalist and said, pointing at it, "Tomorrow Reagan is in here."

Elsewhere in the city, a calm continued that appeared to indicate many people remain outside the metropolis. At least one foreign company is said to have evacuated its personnel to other parts of Libya in fear of a second American attack.

People on the street and at the funeral seemed unaware of any connection between Qaddafi's support for terrorist actions and the violence that has befallen them here at the hands of the United States.

Qaddafi, far from claiming support or responsibility for the actions that provoked the American raid, said in his first appearance since the attack, "We did not issue any orders whatsoever to kill any person in the world. But Reagan ordered the killing of our children and attacks on our cities."

To date, that is what the Libyan people appear to believe. And, having seen not only the first raid by the Americans, but having been wakened on every night since by antiaircraft batteries launching their missiles into the air and sending red tracers flashing across the clear sky, few believe that they are facing anything but an unprovoked American aggression.