Joined only by Bangladesh and Chad, the United States cast its vote today against a voluntary international code to restrict the marketing of infant formula and other breast milk substitutes.

The code was drafted in response to charges that as many as a million Third World babies die of malnutrition each year when they are given commercial formula and other baby foods prepared under unsanitary conditions.

The roll-call voice vote at a special committee of the annual assembly of the World Health Organization found 93 governments in favor of the code, three against and nine abstaining.Forty-five countries were absent when the vote was taken.

Gerald B. Helman, U.S. ambassador to the United Nations in Geneva, told delegates after the today's vote, "We have serious concerns about this organization's involvement in commercial code and this is a central basis for our inability to support this code." He was referring primarily to Article 5 of the code which states, "there shall be no advertising or other form of promotion to the general public of products within the scope of this code."

Bangladesh and Chad voted against the code for technical reasons, and have said they will cast "yes" votes Thursday when the full assembly meets to ratify today's vote.

With the exception of Japan, which abstained, major U.S. allies came out strongly in favor of the code. The 10-nation European Economic Community, which voted as a bloc, underscored" our commitment to the guiding principles expressed in the code."

Sweden, speaking on behalf of the five Nordic countries, termed the code a "minimum compromise."

The code was adopted as a nonbinding recommendation, and WHO member governments were urged to "translate" it into national law and regulations.

The U.S. decision to vote against the code had aroused opposition in the United States where many groups have been lobbying against the promotion of infant formula in poor countries and boycotting products made by Nestle, the world's major manufacturer of infant formula.

Last week, two senior officials of the Agency for International Development resigned after publicly criticizing the decision to vote against the code. One of them, Eugene N. Babb, AID's top agricultural and rural development official, said the decision would be "seen in the world as a victory for corporate interests."

Helman said the code's restrictions on the advertising of breast milk substitutes "cause serious legal and constitutional problems for the United States." The Reagan administration has indicated it believes such restrictions would be in violation of the First Amendment to the U.S. Constitution.

He added that the U.S. government's rejection of the code did not imply a rejection of breast-feeding.

"We strongly support efforts to promote and protect breast-feeding as the ideal form of infant nutrition," Helman stated. "Our own bilateral assistance programs encompassing education, training and dissemination of information in the promotion of breast-feeding and the improvement of infant and maternal nutrition attest to this commitment."

As expected, the strongest statements in favor of the code came from Third World countries, for whose benefit the code was mainly intended. Algeria, which has been one of the leaders of the group. backing the code, said it dealt with a "health problem, not one of trade."

The spokesman for Nigeria, black Africa's most populous nation, said his country supported the code as a way to stop the rise of "harmful bottle feeding." The use of infant formula by illiterate mothers in unsanitary conditions was the "major cause of infant diarrhea cases", which are often fatal, in Nigeria, the delegate said.

Passage of the code was a sharp rebuke to infant formula companies, which had lobbied hard against it here. The International Council of Infant Food Industries, the Zurich-based industry lobby which says its members account for 85 percent of world infant formula sales, charged backers of the code with issuing "misleading propaganda" about the issue. The council's president, Ernest Saunders, who is also a vice president of Nestle, called the code "restrictive, irrelevant and unworkable."

Nongovernmental backers of the code, led by the International Baby Food Action Network, a coalition of church and consumer activists and Third World aid groups, termed the adoption of the code "a moral victory," but added, the real fight begins now -- in getting the code implemented and setting up a workable system to monitor its performance."