The Supreme Court agreed yesterday to decide whether the International Longshoremen's Association has the right to handle certain containerized cargo within 50 miles of a port.

Conflicting rulings by lower courts over ILA contracts covering shippers in New York, Baltimore and Hamption Roads contributed to the controversy.

In the contracts, the longshoremen won the right to unpack, repack and load huge cargo containers shared by more than one shipper and originating within 50 miles of the port. Teamsters union members were performing some of this work for consolidators, firms located away from the piers who collect cargo from more than one shipper for transport in the same container.

The battle over containerization jurisdiction played a pivotal role in a two-month strike in 1977 that shut down ports from Maine to Texas, and government lawyers asked the Supreme Court for a speedy decision because negotiations will start this spring on new labor agreements covering the Gulf and East Coast ports beginning in September.

Containerization permits the handling of huge amounts of cargo, secured from damage or theft, by fewer persons than previously. Between 1958 and last June, the number of registered longshoremen in the Port of New York decreased from 31,629 to 10,919 and their total work hours declined from 43 million man-hours to 17.7 million, while the amount of cargo handled almost doubled, under an agreement with the ILA.