Malta and Libya have signed a military agreement calling for Libyan training of Maltese forces and for unspecified Libyan assistance at Malta's request "in case of threats or acts of aggression" against the strategically placed Mediterranean island nation.

The new military agreement, part of a larger friendship and cooperation treaty signed on Nov. 19 but published only within the past two days, has renewed concern among western diplomats and Malta's opposition party over Libya's expanding role here.

It was not immediately clear whether the treaty would involve the stationing of Libyan advisers in Malta, but the leader of Malta's opposition Nationalist Party, Eddie Fenech-Adami, said tonight that his party was "alarmed at the government's security arrangement with Libya . . . at a moment of huge internal difficulties."

Several diplomats expressed concern that Malta's socialist prime minister, Dom Mintoff, may be giving -- if unintentionally -- Libyan leader Muammar Qaddafi an influential foothold in Malta. The Maltese government has kept silent on reports that the Libyan Embassy here organized this month's foiled assassination attempt against a Libyan opposition leader in Cairo.

Qaddafi and Mintoff signed the Libyan-Maltese treaty here on the same day the Egyptian government announced that it had arrested two Maltese and two Britons who had been directed in the assassination attempt by Libyan diplomats in Valletta. The Libyan government has not denied using its embassy in Malta to direct the assassination attempt. During his visit here, Qaddafi ignored questions on the issue, calling Egyptian President Hosni Mubarak a CIA agent and President Reagan a "madman."

Western diplomats said that Malta's failure to distance itself from the assassination plot and from Qaddafi's attacks here on foreign leaders were undermining Malta's proclaimed policy of neutrality.

Since he forced NATO to withdraw a major naval base from Malta in 1979, Mintoff has pledged to balance Maltese relations between East and West.

He has pressed Malta's commercial partners to guarantee balanced trade with the island country, and has employed embargos on imports -- notably from Italy and Japan -- to pressure them to comply. Some nations, including Iraq, the Soviet Union and Libya, have signed balanced trade agreements, but businessmen and opposition leaders say they have not brought increased orders for Maltese goods.

Businessmen agree that Malta's economy is suffering not only from the world recession but from excessive government control. They and foreign economic analysts suggest that the Maltese unemployment rate is nearly twice the official figure of about 10 percent.

The economic malaise has aggravated Malta's bitter political conflict, which has provoked a steady chain of violent incidents since the last elections in 1981. Thanks to a last-minute change in electoral boundaries, Mintoff's Labor Party retained a majority of parliamentary seats although it was outpolled by the Nationalists, 51 to 49 percent.

The Nationalists and Malta's powerful Roman Catholic Church claim Mintoff has resorted increasingly to mob violence and harassment of his opponents to secure his hold on power. One year ago, the Nationalist Party published the text of a secret treaty between Malta and North Korea for the supply of Korean arms and advisers to Malta's police force.

"Such treaties -- with countries with whom we would prefer not to associate -- are especially alarming to us when the deputy prime minister speaks about the possibility of canceling the next elections or of creating a one-party state," opposition leader Fenech-Adami said. The government made the threat while accusing the church and foreign political parties of intervening in elections on the side of the Nationalists.

The most recent phase of Malta's internal hostilities has been over the Catholic schools, for which the government wants the church to stop charging fees. The church, noting that the government recently tried to expropriate a large number of its properties, says it feels under constant attack from Mintoff and his Labor Party.

In late September, Deputy Prime Minister Karmenu Mifsud-Bonnici led a motorcade of angry Labor supporters to Valletta's courts, where some of them ransacked offices, apparently in retaliation for a court ruling against the government. Some of the mob then vandalized the offices of Malta's archbishop with the apparent acquiescence of police stationed outside.