The Carter administration's long and ill-starred search for a new FBI director has ended with the selection of a Republican federal Appeals Court judge from St. Louis, William H. Webster.

The official White House announcement to be made at 1 p.m. today by Attorney General Griffin B. Bell. Knowledgeable sources said last night that President Carter had picked Webster, 53, over another federal judge, Frank J. McGarr of Chicago, the other finalist in the running to succeed Clarence M. Kelley, who is retiring Feb. 15.

Webster is a former federal prosecutor who was appointed a U.S. District Court judge by then-President Nixon in 1971. He was elevated to the Eight U.S. Circuit Court of Appeals in 1973.

He is said to have agreed to serve the full 10-year term for the job, which pays $57,500 a year, the same as his judgeship salary.

His selection ends a long and difficult process, which saw Bell and Carter junk the recommendations of a blue-ribbon commission and turn back to an original choice, highly respected federal Judge Frank M. Johnson of Alabama, only to see Johnson withdraw in December after failing to recuperate swiftly enough from major surgery.

Bell then began a personal search, drawing on the friendships he had made during his tenure as a federal judge.

The FBI has been rocked in recent years by a series of scandals about spying on American citizens, burglaries by agents and petty corruption by long time director J. Edgar Hoover and his close circle of aides.

Bell is known to believe that a qualified federal judge would have the aura of integrity to restore bureay morale and public confidence completely.

The Attorney General's attention focused early this month on Webster, McGarr and James Neal, the prosecutor in the Watergate cover-up trial of former President Nixon's closest aides.

Neal, however, withdrew from consideration because he was not willing to commit himself to serving the full term.

McGarr was tarred somewhat by newspaper reports in Chicago that tied him peripherally to the scandal-ridden Teamsters union's Central States Pension Fund.

Webster is little-known nationally, but has a reputation for honesty and fairness in his native St. Louis.

While Webster is not known ever to have been accused of an impropriety, he might face some difficulty in his confirmation hearings because of membership in a social organization called the Veiled Prophet Society, which is reported to have about 1,000 white, male members and has been accused of racism.