In the face of a trend toward international regulation of industry and commerce, the United States, with its free-trading philosophy, often seems to resemble Canute, the 10th-century Danish king who commanded the waves to halt. He knew the gesture was futile, but he had a political point to make.

The nautical metaphor, sometimes heard in discussions of this country's unsuccessful effort to win amendments to the Law of the Sea treaties, is appropriate to the latest episode. Over U.S. objections, the seafaring nations of the world are about to adopt new regulations for maritime commerce that will change the legal and economic rules of merchant shipping to benefit Third World countries.

The new rules were adopted by the United Nations Conference on Trade and Development and are embodied in a document known as the UNCTAD Code of Conduct for Liner Conferences. It was adopted in 1974, but only now, with its impending ratification by Britain and West Germany, is it about to go into effect.

To its critics, the code is a giveaway that discourages maritime competition and can only result in higher costs for shipping goods in international trade. To its supporters, the code is a necessary set of compromises required to reconcile the conflicting maritime policies and protectionist tendencies of developed and developing nations and of Socialist and free-enterprise countries.

It seems certain that the code is going to go into effect worldwide, probably by early next year, but the United States is not going to ratify it because its provisions conflict with U.S. law and violate the country's free-trading principles.

The prevailing view in the U.S. maritime community is that the United States should recognize the inevitability of the new international maritime system and either ratify the code or, preferably, negotiate bilateral agreements with its trading partners to ensure equal treatment for U.S. ships and shippers. If the code takes effect without some response from the U.S. government, shippers and exporters fear international freight costs will rise and ship operators fear they will be excluded from foreign routes.

Last month, Transportation Secretary Drew Lewis announced formation of an "interagency international shipping policy group to evaluate the options available to the U.S. government" in the face of maritime policy changes by other nations.

The group's assignment, according to an authoritative source in the administration, is to persuade other maritime nations to refrain from implementing the UNCTAD code, if possible, and if not to consider the development of bilateral agreements that would circumvent it.

Administration sources made clear that the United States opposes bilateral shipping agreements almost as firmly as it opposes the UNCTAD code, but many maritime experts believe that the reality of the new rules on the oceans will force the administration to modify its position.

An indication of how difficult it may be to head off the UNCTAD rules through bilateral deals came in early August, when a high-level U.S. delegation went to Manila to try to reverse a unilateral decision by the Philippines to put the code's provisions into effect even before ratification.

After two days of talks, the American team, headed by Deputy Assistant Secretary of State Matthew Scocozza, obtained only an agreement by the Philippines not to apply the new regulations to U.S.-flag vessels pending "further study of the maritime rules, regulations and laws applicable in each country."

The UNCTAD code applies only to "liner" ships: common-carrier vessels that sail fixed routes according to a schedule and solicit cargo from the public. It does not apply to to the so-called bulk trades, ships such as tankers and ore carriers that transport a single commodity on demand. Many maritime experts believe, however, that once the liner code is fully in place, the developing countries that pushed for it will seek similar rules for the bulk trade.

The UNCTAD code was designed to bolster the fledgling merchant fleets of the developing nations, mostly by shielding them from competition from the efficient, mechanized fleets of the industrialized countries.

The provisions that the United States finds unacceptable are among the code's most important:

* Liner "conferences," or groups of ship operators serving a particular route, would be permitted to close their memberships. That could give the developing nations effective control over freight rates for imports and exports, presumably raising rates because their fleets are less efficient.

* Ship operators would be permitted to give rebates and preferential rates to large-volume or frequent shippers. U.S. law prohibits rate discrimination.

* Freight rates would be set "at as low a level as is feasible from the commercial point of view and shall permit a reasonable profit for shipowners." The United States believes this conflicts with an economic system that encourages business to maximize profits.

The most controversial feature of the code would encourage signatory nations to enter cargo sharing arrangements for freight between them. Countries carrying on trade with each other would give their own national shipping lines "equal rights to participate in the freight and volume of traffic generated by their mutual foreign trade," with ships of third countries entitled to "a significant part, such as 20 percent" of the freight in that trade.

This formulation has been widely interpreted to mean that any nation could reserve 40 percent of its incoming and outgoing liner freight for the ships of its own fleet. It would penalize "cross traders," including some U.S. companies and the big European ship operators, who now carry much of the liner cargo between third countries.

The nations of the European common market, in agreeing to ratify the code, decided not to apply its provisions in trade between themselves and other industrialized countries, but it will be in effect in commerce with most of Asia, Africa, the Middle East and Latin America. Presumably this would mean that European maritime trade with the United States would not be affected, but some experts believe that once the Europeans modify their maritime laws to conform to the code, the effect on the United States will be the same as if they were formally applying the code.

The official American view of the code was reported to Congress last year by J. Todd Stewart, then director of the State Department's office of maritime affairs.

The "concept of self-restraint" on profits, he said, is "fundamentally different from the governing principle in the American economy that firms should attempt to maximize their profits in the interest of both the firm's stockholders and the economy as a whole." Profit maximization is not a primary concern to many countries where the ships are state-owned.

Stewart said the "cargo-sharing provisions will cartelize the transportation of trade. Such provisions subordinate trade to transport; they restrict the choice of shippers and may result in delay of shipments and consequent loss of trade." He also pointed out that many of the code's provisions conflict with U.S. antitrust law.

Albert E. May, executive vice president of the Council of American-flag Ship Operators, said that when the European nations ratify the code, "it will result in the worst possible situation for us. The effect would be to have closed, rationalized, strong conferences, with rebates, in the rest of the world, so our carriers can't get in, but keep the U.S. trades open."

The State Department's position, he said, is "no code, and no bilateral cargo-sharing agreements except as a last resort. But people around the world are putting deals into effect to get ready for the code. We need the protection."

Peter J. Finnerty, vice president of Sea-Land Industries, a major U.S.-flag container-ship line, said the endorsement of closed conferences "will be used to achieve foreign-government control of closed trades. It is just such an environment of closed markets controlled by government rules, quotas and political pressures that stifles private enterprise and generates inefficiency."

The code, he said, will "move worldwide liner shipping away from market competition toward inefficient government economic control" -- an outcome he said could be headed off if the U.S. government "will stop studying the matter and step up to the negotiating table with a strong position."

Frank Drozak, president of the Seafarers International Union and a supporter of cargo-preference arrangments to increase the American-flag fleet's share of U.S. trade, has endorsed the UNCTAD code. In his view, a "positive cargo preference policy" is needed to end the decline of the U.S.-flag merchant fleet, which now carries only about a quarter of the nation's liner trade commerce and about 4 percent of its bulk trade.

"That policy," Drozak said, "should include the ratification of the UNCTAD code and the negotiation of bilateral shipping agreements for bulk cargoes with major U.S. trading partners."

Legislation to guarantee a larger share of the bulk trade for American ships was introduced last week by Rep. Lindy Boggs (D-La.) and 17 bipartisan cosponsors. There is virtually no chance that it will be enacted in this Congress, but its existence is evidence of growing support here for cargo sharing arrangements, in both bulk and liner trades.

Exporters of commodities and manufactured goods, however, are strongly opposed to cargo-sharing because they believe it artificially inflates the cost of exports.

At a conference on the liner code at the U.S. Merchant Marine Academy in May, Leslie Kanuk, a professor at the City University of New York, denounced it as a "complex, poorly written, ambiguous, sometimes contradictory document" that will "fragment world trade, eliminate or minimize independent competition, apportion cargo without regard for relative differences in commercial efficiency, and eliminate conference flexibility."

At the same meeting, Andrew E. Gibson, president of Delta Steamship Lines Inc., argued forcefully for bilateral agreements to protect U.S. shipping interests.

Assuming that the United States desires, as a matter of national policy, to maintain a merchant fleet, Gibson said, "we really only have three options" in the face of the UNCTAD code.

"We could do nothing, in which case, the future of the U.S.-flag merchant marine is easy to predict. We could ratify the code, or ratify it with reservations, as the European community is proposing to do. Or we could adopt a flexible policy which is presumptively in favor of cargo agreements benefitting the U.S. flag but which is not locked into any specific formula."