COPENHAGEN, Feb. 19— A Danish connection to the Iran-contra affair has become clearer in the last week, largely as a result of a court case here. 

A Copenhagen shipping firm figured in efforts by two associates of Lieut. Col. Oliver L. North, then on the National Security Council staff, to provide arms to Iran and the Nicaraguan rebels. The two men are Albert Hakim, an Iranian-born California businessman, and Richard V. Secord, a retired Air Force major general. 

The Copenhagen firm, Queen Shipping, has filed a lawsuit against a company controlled by Mr. Hakim that is said to owe Queen Shipping about $200,000. The firm's two partners, Svend Andersen and Tom Parlow, have talked publicly about their dealings. Details have also been provided by the Danish Seamen's Union, which monitors arms traffic involving Danish ships. Disclosures Contradict Reagan 

The disclosures contradict comments by President Reagan at a news conference in November. At the time, the President dismissed charges by the seamen's union that the United States Government might be using Danish ships for the Iran arms deals ''We certainly never had any contact with anything of the kind,'' he said. 

Besides the Danish firm, the Hakim-Secord operation included Swiss bank accounts and dummy companies in Panama and Geneva. Yet for all the intrigue and expense, the operation achieved few of its aims. 

Among the projects that fell through was an attempt to exchange rifles in Iran in November for two captured Soviet T-72 tanks, sought by the Pentagon for intelligence purposes. 

''The whole operation was very amateurish in many ways,'' said Henrik Berlau, vice president of the Danish Seamen's Union. 

Still, a couple of the deals succeeded. For example, the Copenhagen firm confirmed that it had arranged a shipment in October of AK-47 rifles from Poland to be delivered to an Army warehouse in North Carolina. 

The Los Angeles Times reported that the shipment was apparently intended for the Nicaraguan rebels, known as contras, since the Pentagon buys Soviet-bloc weapons for rebels fighting Communist-supported governments. But the shipment of Soviet-bloc weapons to a warehouse of the Pentagon also raises the question of its role, if any, in the clandestine deals. Court Action Over Hakim's Debt 

The Justice Department investigation of the Iran-contra affair seems to have led to the court action here. The Queen Shipping partners say they believe Mr. Hakim cannot settle the $200,000 debt because his Swiss bank accounts were frozen in December at the Justice Department's request. 

Queen Shipping, according to Mr. Andersen, sent its bills not to the Hakim-controlled shipping concern, Dolmy Business Inc., but to the Compagnie de Services Fiduciaires in Geneva, the apparent paymaster for the operation. 

For eight months starting last spring, Queen Shipping arranged arms shipments at the behest of Mr. Hakim, the firm's partners said. 

''It was always Hakim who called us, saying where the ship should go next,'' Mr. Andersen recalled. 

The ship movements were a complex pattern of shuttling among ports in Europe, in the Middle East and even in the United States. The main ship was the Erria, a 163-foot freighter. Mr. Hakim came here to negotiate for its purchase from Arne Herup, the captain, for $312,500 on April 28. Geneva Company Bought Ship 

Mr. Hakim was accompanied by Willard I. Zucker, an American lawyer who effectively ran the Geneva company. The Danish register of ships shows that the Geneva company bought the Erria and that Queen Shipping was engaged to operate it. Contracts for Dolmy Business, a Panamanian dummy company used by Mr. Hakim, usually gave its address as in care of the Geneva company. 

Crew members' contracts provided unusually high life insurance. In one contract, signed June 20, Dolmy agreed to pay for a $300,000 life insurance policy; a standard level is $75,000. 

''Those huge insurance policies show that they knew what they were doing was unusual and dangerous,'' said Mr. Berlau. 

Soon after the ship's purchase, Mr. Hakim had the Erria's flag of registry changed to Panama, where operating regulations are looser. The ship's involvement in carrying the AK-47 rifles and the attempt to trade arms for the Soviet T-72 tanks show how it worked. 

On July 10, the Erria arrived in Szczecin, Poland, where it picked up the AK-47 rifles. Nine days later, the ship picked up munitions in Setubal, Portugal. Documents presented to port officials said it was departing for Yemen, but it soon returned, reporting engine trouble. It set off again with a stated destination of Guatemala and once more returned. Finally it left for Cherbourg, where it arrived Sept. 13. 

Such erratic movements are characteristic of vessels in the arms trade, according to shipping sources. 

At Cherbourg, Mr. Hakim had the cargo transferred to a Danish-flag freighter, the Iceland Saga, which on Oct. 8 arrived at the Sunny Point Munitions Depot, an Army warehouse near Wilmington, N.C., the operators say. 'Where It Went, We Don't Know' 

Officials of the Danish firm say they do not know whether the AK-47 rifles were headed for Nicaragua. ''The cargo was discharged in Wilmington,'' Mr. Andersen said. ''But where it went after that, we don't know.'' 

By contrast, the rifles to be traded for two Soviet tanks never reached Iran. The Erria loaded them in November at Haifa, Israel, and then headed toward Bandar Abbas, Iran, but for unexplained reasons never docked. 

After waiting in the Gulf of Oman for 32 days, the Erria returned to Eilat, Israel, on Dec. 12 to unloaded its cargo, mostly AK-47 rifles. According to the ship's crew, the dock workers in Eilat were the ones who had handled the cargo in Haifa. The Israeli suppliers may have deemed it necessary to use the same crew to keep the deal secret. 

The Erria is now docked in the Danish port of Korsor. The Danish court has seized the ship as collateral for the money that Mr. Hakim's company is said to owe Queen Shipping. 

The American operations have focused attention on the broader issue of Danish involvement in arms trafficking. There now appears to be majority support in the Danish Parliament for a bill that would prohibit Danish firms from shipping arms to countries at war or to trouble spots. The bill would also require companies to get Government approval to transport arms.