William S. Sessions, the newly confirmed director of the FBI, was hospitalized early yesterday for a bleeding ulcer as he arrived in Washington for his swearing-in ceremony. Doctors said he was in good condition and, barring complications, would be released after two or three days' observation.

Justice Department officials said the swearing-in, scheduled for 11 a.m. yesterday at the FBI's Pennsylvania Avenue headquarters, was postponed indefinitely. But they said Sessions, a federal judge from San Antonio, is expected to take over the Federal Bureau of Investigation after a short recuperation.

White House spokesman Marlin Fitzwater made clear that the administration does not consider the illness a serious problem. "Usually," he joked, "when people come to Washington, it takes a couple of weeks to get an ulcer."

President Reagan and Attorney General Edwin Meese III visited Sessions yesterday at George Washington University Medical Center.

Dr. Allen Ginsberg said Sessions "bled from a small ulcer of the duodenum," the section of the small intestine nearest the stomach, during a flight Wednesday night from Dallas to Washington.

Ginsberg called the ulcer "entirely benign" and said Sessions will be treated by medication to reduce stomach acid secretions. He said Sessions should recover completely and have no restrictions on his diet or activities.

Asked whether he thought the ailment might affect his performance as FBI director, Ginsberg said, "Absolutely not."

Although the condition was previously undiagnosed, Ginsberg said that Sessions, 57, has had "some indigestion and burning pain" for the last six to nine months, particularly after eating Mexican food, and probably had the small ulcer then. He said the bleeding apparently was triggered after Sessions took an aspirin on an empty stomach.

Justice Department spokesman Patrick Korten said that since new ulcer patients are usually told "to rest for a couple of weeks," the swearing-in probably would be delayed a week or more. But Ginsberg said that "from a medical standpoint," Sessions could be sworn in Friday or Saturday.

Syndicated columnist and television commentator John McLaughlin, who was in the same first-class cabin with Sessions on Delta Flight 462, said the judge rose hurriedly from his seat and rushed toward the restroom but vomited in the aisle and fainted.

He said Sessions was quickly surrounded by FBI agents, and a physician was called over the plane's public address system. McLaughlin said a passenger who identified himself as a physician diagnosed the condition as "air sickness" and persuaded Sessions to lie on the floor for about 45 minutes. Sessions then returned to his seat and slept until shortly before the plane landed, close to midnight Wednesday.

Milt Ahlerich, an FBI official, said Sessions was met by an FBI vehicle, which took him to the hospital.

McLaughlin said Sessions' wife, Alice, told him that the judge had eaten only one meal Wednesday as he rushed to prepare for the trip. He had expected to be sworn in later this month and learned only Tuesday that the ceremony would be Thursday.

Reagan had planned to use the occasion to promote the controversial nomination of Judge Robert H. Bork to the Supreme Court. Korten said the swearing-in was moved up not to give Reagan a forum but to accommodate the schedules of various officials, including former Supreme Court chief justice Warren E. Burger, who was to administer the oath.

Sessions became U.S. attorney for the western district of Texas in 1971, a U.S. District Court judge in 1974 and chief district judge in 1980. He was confirmed by the Senate, 90 to 0, for the 10-year term as FBI director. He succeeds William H. Webster, the new head of the Central Intelligence Agency.