The International Longshoremen's Association and the International Association of Machinists will begin a boycott next week of Nicaraguan ships and aircraft calling in the United States, on AFLCIO spokesman said yesterday.

The machinists, the spokesman said, will refuse to service daily Miami flights of Lanica, the national airlines owned by Nicaraguan President Anastasio Somoza. The longhsoremen's action affects Nicaraguan ships carrying the country's principal exports -- coffee, coton, beef and sugar -- as well as other goods, to U.S. ports.

The unions originally voted a boycott of Nicaragua, Chile and Cuba in a regional labor council meeting last November but have delayed implementation. Yesterday's decision on Nicaragua, the AFL-CIO said, was based on the January murder of a Nicaraguan labor leader in Managua, requests for a boycott by anti-Somoza unions in Nicaragua, and threats against local Nicaraguan AFL-CIO representatives following a break-in of their Managua offices by paramilitary last week.

The unions were also influenced, the spokesman said, by the arrival in Nicaragua this week of an International Monetary Fund team that is investigating a loan request by the beleaguered Somoza government.

In a three-day London meeting beginning Monday, the International Transport Workers Federation, of which both the Longshormen and machinists are members, plans to consider an international boycott of Nicaragua.