A high-level Nicaraguan delegation has returned from a lengthy tour of Eastern Europe with a substantial aid package and agreements to strengthen ties with the Soviet Bloc.

The tour by Moises Hassas of the ruling five-member junta and three key leaders of the controlling Sandinista National Liberation Front, illustrates the government's decision to "diversify" its international relations after decades of close U.S. ties fostered by dictator Anastasio Somoza, who was ousted last July. It should result in a substantial increase in the Soviet presence in volatile Central America.

On the tour of almost a month, the Nicaraguan delegation signed joint communiques with the Soviet Union and East Germany that followed the Soviet line on almost all international issues, including Afghanistan.

The communique with Moscow condemned "the campaign by imperialist and reactionary forces to increase international tension around the events in Afghanistan." The campaign, it said, aims to "stifle the inalienable right of the people of . . . Afghanistan . . . to follow the road of progressive change."

While the Soviets and Nicaraguans agreed on a whole litany of issues, most of the positions -- such as on Middle East issues -- coincide with those of the nonaligned movement. Nicaragua's new government identifies closely with these Third World approaches.

Interior Minister Tomas Borge made a speech in Moscow stressing Nicaragua's "irrevocable decision to be free." He told Soviet leaders at a luncheon that Nicaraguans intend to "continue being the masters of our own destiny."

While that delegation was in Eastern Europe, another headed by junta member Sergio Ramirez and Sandinista leader Bayardo Arce was touring Western Europe. At the same time, Daniel Ortega, a member of both the junta and the nine-man national directorate, visited several Latin American countries and the Vatican.

The Nicaraguan leaders' travels came at the same time that a $75 million U.S. loan to Nicaragua was stalled in Congress. Seeking new sources of aid was an important goal of the trips.

Ramirez and Arce announced that they had received pledges of about $55 million in loans, grants and emergency aid from the European Community as well as Belgium, the Netherlands, West Germany, Sweden, Austria and the special fund of the Organization of Petroleum Exporting Countries based in Vienna.

The total amount of aid obtained on the trip to Eastern Europe has not been announced. Press reports from Prague said Czechoslovakia had provided a $20 million loan and a Foreign Ministry spokesman said new East German aid would total $30 million.

The delegation to the Soviet Bloc was nominally headed by Hassan, a hard-line leftist. The three members of the Sandinista national directorate who went on the trip are considered to be among the most powerful men in Nicaragua: Borge, who as interior minister controls the police. Army commander Humberto Ortega and the popular former guerrilla commander Henry Ruiz who has taken over the important Economic Planning Ministry.

In Moscow, the Sandinista front signed a "cooperation program" with the Soviet Communist Party.

The communist governments rolled out the red carpet for the Nicaraguans. According to reports by a correspondent for the Sandinista newspaper Barricada who went along, the Nicaraguans were cheered by thousands of flag-waving Soviet citizens in Leningrad. They attended the Bolshoi Ballet in Moscow and watched a demonstration by East German tanks.

They also visited Bulgaria and Czechoslovakia. Army chief Ortega went on to Algeria and Libya.

In each country, the Nicaraguans signed agreements on trade, economic and technical aid and cultural exchange. The Soviet Union has promised to aid the Nicaraguan fishing industry and Czechoslovakia is committed to help build a textile factory.

Nicaraguan lenders, angered by delays and debate in Washington over U.S. aid, stress that aid from both Eastern and Western Europe is "absolutely without conditions." A Soviet ambassador is to arrive here next week and the Soviet airline Aeroflot will begin flights to Managua next month.

The only other Soviet embassy on the Central American isthmus is in Costa Rica. The Soviets also have an embassy in Mexico and are a major presence in Cuba, a close ally of Nicaragua's new government.

Since the takeover last year, members of the junta and the Sandinista national directorate have visited the United States on four occasions. Two months after taking office, three junta members met with President Carter at the White House. Interior Minister Borge has been invited to visit the United States later this month.

Even as Nicaragua moves close to the Communmist Bloc on the world stage, one of the country's three small communist parties has run into serious trouble. Fifty-five leaders of the Communist Party of Nicaragua were arrested when their union federation staged a series of strikes last month. Many are still in jail. The union federation's office was attacked by members of the Sandinista labor federation and the government has accused the party of collaborating with the CIA to undermine the economy.

The party has been expelled from a Sandinista-sponsored political alliance and a coalition of labor federations.