About 3,300 refugees from Vietnam on board a Taiwan-owned freighter ended nearly a month-long ordeal last night when Hong Kong authorities finally agreed to give them temporary shelter.

The refugees had been waiting just outside Hong Kong territorial waters since Dec. 23 after being picked up in mysterious circumstances off Vietnam. Hong Kong authorities refused to let the ship in because its listed port of call was Koahsiung, Taiwan, not Hong Kong. They only relented when worsening weather threatened the health of the refugees, including about 1,000 children.

While the plight of the freighter Huey Fong is one of the more dramatic cases of Vietnam's "boat people" refugees, it is but one among many -- about 85,000 Vietnamese have fled by boat in recent years.Other thousands of mostly ethnic Chinese have crossed by foot into China. Refugee flows from Laos, Cambodia and Burma bring the overall Southeast Asian total in camps or now resettled to more than 800,000.

The recent plight of the freighter Hai Hong, off the Malaysian coast, dramatized the latest refugee surge from Vietnam.

The Huey Fong's passengers will nearly double the number of refugees in temporary shelters in Hong Kong, estimated until now to number about 4,000. Eventually most of the refugees are expected to go the United States, the resettlement point for more than 90 percent of the Vietnamese who have arrived here since the end of the Vietnam war in 1975.

While the Huey Fong waited at anchor outside Hong Kong waters, however, the Hong Kong government passed stringent new laws to discourage further refugeeloaded boats from coming here. The ship was anchored just off the western tip of Hong Kong island tonight after the captain had been authorized to sail into Hong Kong waters at the risk of criminal action against him if it is determined the refugees paid to come on board his freighter.

Immigration authorities plan to board the ship and question the refugees. Government officials say that if it is determined any of them paid for their passage on the vessel out of Vietnam, the captain, Shu Wen-shin, would be liable for heavy fines and a jail term of up to four years.

The refugees will be housed at a nearby rural air force base. Hong Kong authorities have provided regular food and medical supplies to the ship while it was anchored at sea but insisted that the vessel continue on to Taiwan. Some of the refugees on board had at one point threatened a mass suicide and some youths had tried to force the captain earlier to sail into Hong Kong waters despite the fact the ship was surrounded by several Hong Kong marine patrol vessels.

Hong Kong authorities said they were surprised to learn this week that the vessel had more than 3,300 people on board. Earlier estimates had placed the number at 2,700. Another freighter loaded with refugees from Vietnam, the Tung An, is presently anchored off Manila and has so far been refused permission to land its refugees by the Philippine authorities.

The captain of the Huey Fong has said he picked the refugees up off small boats that were about to sink several miles off the coast of Vietnam. The Hong Kong-based magazine, the Far Eastern Economic Review, however, charged recently that the ship had actually docked in Vietnam and picked up the refugees for fees totaling about $5 million.

Hong Kong officials had no success in persuading the captain to sail on to Taiwan as Taiwan authorities repeatedly refused to give any encouragement that they would accept the refugees.

Hong Kong authorities said their decision to let the Huey Fong enter Hong Kong did not alter their principle that ships would not be accepted in Hong Kong waters if Hong Kong was not their first port of call.

Hong Kong shipping officials said the freighter was sold to Taiwan owners in September 1977. Authorities here have been unable to determine exactly what the ship's role is in an alleged scheme to make profits by picking up Vietnamese refugees. But international relief officials here say they thought it highly unlikely that so many refugees would have by chance reached a freighter passing Vietnamese waters at the same time without some kind of prior arrangement.