LONDON, AUG. 5 -- The Customs service said today it is investigating alleged illegal arms shipments from Britain to Iran and Iraq, and a new report said up to 50 British companies could be involved.

"Our inquiries involve a number of British companies but we are not prepared to name them," Customs said in a brief statement. It gave no other details.

The Financial Times, Britain's leading business daily, said the investigations apparently had been going on at least since April and involved as many as 50 British companies.

Press Association, the British domestic news agency, said it understood that Iran was the main recipient of the weapons.

The Foreign Office said it had been informed of the investigations but gave no other details.

The Customs service statement was released after a report by Independent Television News shown earlier today. The network said its investigations revealed that the alleged shipments were worth millions of dollars and included rockets, missiles, tanks, small arms, spare parts and electronic equipment for fighter planes.

Prime Minister Margaret Thatcher's Conservative government has banned the export from Britain of equipment that would worsen or prolong the war between Iran and Iraq. The conflict broke out in September 1980.

Spare parts may be sent where contracts for such services are still in force, but no arms may officially be exported from Britain to Iran without a government license. No such licenses have been issued for more than eight years.

Diplomatic relations between Britain and Iran have been scaled down sharply after a dispute between the two governments over the treatment of officials.

Britain has allowed the Iranian arms buying office in London to remain open. The Iranians use the office as a center for negotiating arms purchase deals in Europe.

Another London paper, the Daily Mail, said companies with connections in New York, Boston, Los Angeles, London, northern England, Australia and the Far East were being investigated.