The FBI has charged two Washington men with transporting a 12-year-old boy from Baltimore to the District for the purpose of engaging in sexual activities with a man who actually was an undercover FBI agent assigned to investigate the case.

Law enforcement officials described the arrests as the first here under a 1978 federal law that prohibits the interstate transportation of minors for sexual purposes.

Timothy M. McNamara, a 22-year-old busboy at the Fairfax Hotel, was charged under the Sexual Exploitation of Children Act with transporting the youth to engage in oral sex. Philip Herbert Garrett, 25, said to be a resident of the Terminal Hotel, in the 1200 block of New York Avenue NW, was charged with aiding McNamara.

McNamara was released on personal recognizance following arraignment in District Court here. Garrett was being held in $2,000 bond. Both men face maximum penalties of $10,000 in fines and 10 years in prison.

Theboy has been returned to his parents in Baltimore.

The arrests climaxed an investigation that "was like shopping for a used car," in the words of one federal official. An FBI spokesman said agents conducting the investigation received offers of sex with young boys of various ages, either singly or in groups.

According to the FBI, the transaction leading to the arrests began Feb. 17 outside the Naples Cafe, also in the 1200 block of New York Avenue NW, where youths between 12 and 18 typically "stand on the corner to sell themselves," the FBI spokesman said.

There, an FBI undercover agent met Garrett, the spokesman said, and asked "where around town young boys could be found." According to the spokesman, Garrett invited the agent to "come by the next night."

The following night, the FBI account said, the agent met Garrett, who had been unable to make arrangements, but said he could "line up" somebody else. When the agent declined the offer, the account went on, Garrett said "he could get me anything I want" and suggested the agent call a man named "Tim," giving him a phone number at the Fairfax Hotel.

On March 11, the agent said, he had the first of several telephone conversations with "Tim." The agent, posing as a businessman, asked whether "Tim" could arrange a meeting with a group of young boys,the FBI spokesman said.

"Tim said he would try to do his best," the agent said.

According to the FBI spokesman, McNamara was followed from the Fairfax when he left work the morning of March 14. He boarded a Trailways bus and was followed to Baltimore, where the FBI said he picked up the 12-year-old boy.

The agent had arranged to meet them in the lobby of the Washington Hilton Hotel. He escorted them to his room, where another agent was hiding in the closet.

McNamara, the agent said, demanded $300, $50 of it to cover a taxi ride with the boy from Baltimore. After receiving the cash, the agent said, McNamara gave the boy $20, and was arrested immediately. Garrett was arrested at the Naples Cafe the next day, officials said.

Officials said that there are no local laws designed to control prostitution involving young males. "We don't have adequate law," said assistant U.S. Attorney Daniel Seikaly. "The problem is that prostitution is generally defined as heterosexual and not homosexual in nature."