Two senior officials of the Agency for International Development were pressured to resign yesterday for publicly disagreeing with a Reagan administration decision to vote against international guidelines for marketing baby formula.

AID Administrator M. Peter McPherson said after "lengthy discussions," the two officials -- Dr. Stephen Joseph and Eugene N. Babb -- told him they intend to submit their resignations after the United States casts its vote against the international code at a meeting of the World Health Assembly Thursday in Geneva.

"Naturally, I intend to accept them immediately," McPherson said.

Joseph, AID's top health official, and Babb, the agency's top agriculture and rural development official, had scheduled a news conference for this morning to protest the administration's decision on the infant formula code.

The vote, Babb was quoted as saying in The Washington Post yesterday, "will be seen in the world as a victory for corporate interest" over legitimate health concerns of developing countries.

Joseph and Babb are among the first senior government officials to break with the Reagan administration over a policy disagreement since the president took office in January. And they will be the first to lose their jobs.

McPherson, a former Reagan campaign aide, apparently intends to make an example of them. In an interview last night, the AID administrator said he respects the right of Babb and Joseph "to hold their private opinions, but I cannot accept public, advocacy of their views in an effort to defeat a decision of the administration in their current roles as senior government employes."

Joseph and Babb were both political appointees in the Carter administration, according to McPherson. Babb, he said, has shifted to career status and Joseph has attempted to do so, although his case is still pending.

The two told McPherson Friday about their intention to hold a news conference to voice their displeasure with the administration's decision on the code. McPherson's conversations with the two men came after a story about the news conference appeared in The Post yesterday, and their subsequent decisions to resign were made mutually by the AID administrator and the two officials.

The United States is expected to be the only government among the 157 nations participating in the World Health Assembly to vote against the code. The code is designed to curtail commercial efforts to convince women in underdeveloped, Third World countries to switch from breast feeding their babies to formulas, which often are mixed with contaminated water in these countries.

About 10 million infants and young children annually suffer from sometimes fatal malnutrition and other diseases associated with inadequate breast feeding and the use of milk substitutes, according to government reports.

The code is supported by religious and health groups in the United States, but is opposed by three large formula manufacturers and the Grocery Manufacturers of America.

"As administrator of AID, I fully support the administration's decision," McPherson said yesterday. "I believe it is inappropriate for a United Nations agency to move in an effort at economic regulation."

In its most controversial passages, the code would forbid aggressive marketing tactics such as advertising, distributing free samples or sending nurses and non-nurses dressed in white into maternity wards and villages in underdeveloped countries to promote the use of baby formula.

Supporters of the code argue its provisions are non-binding and would not apply to the marketing of baby formula in the United States.

"In my view, we [the United States] are going to look very foolish to the world," Babb said Saturday. "To me, it's inconceivable that our government could take this position."