The federal courthouse in Alexandria, where spies, embezzlers and cocaine barons draw hardly a glance from courtroom regulars, is suddenly buzzing with speculation about The Case of the Extra Judge.

The question -- worthy of a King Solomon -- is how to fit four federal judges into a 50-year-old courthouse built for three.

"It's a touchy subject," agrees one member of the federal bench, who asked not to be identified.

Like most cases that wend their way through the U.S. judicial process, this one is complex, with elements of humor, ego and more than a little judicial jockeying for position.

Guessing about the outcome shifted into high gear last week with the announcement by Sen. John W. Warner (R-Va.) that President Reagan has chosen Fairfax County Circuit Court Judge James Cacheris to become the next U.S. district judge in Alexandria.

Assuming Cacheris is confirmed by the Senate, there will soon be a freshly minted member of the bench standing at the courthouse door in Alexandria, ready to go to work. Simple housekeeping problems may make that next to impossible.

The building's three courtrooms and their adjacent chambers already are occupied by two active U.S. judges, Albert V. Bryan Jr. and Richard L. Williams, and Oren R. Lewis, who technically retired in 1973 but who continues to hear a full load of cases.

A spacious suite of offices -- without an adjoining courtroom -- on the building's top floor are used by Bryan's father, Albert Sr., an elderly federal appeals court judge who has no known intention of leaving.

Nor does the 79-year-old Lewis, an irascible figure who is popular with court employes and who has made it clear to several of them that he plans to stay right where he is.

Asked if he had talked to Lewis about leaving lately, one federal judge commented: "You don't talk to Judge Lewis. You listen. I haven't listened to him in two or three weeks."

One judge, Williams, says he would readily agree to transfer out of Alexandria, but may not be allowed to in the near future. A longtime private lawyer and then state judge in Richmond, Williams still maintains his home there.

Williams made the news recently when it was disclosed that besides his $67,100 salary, he had been collecting a $50 per diem fee while in Alexandria, where he has rented a townhouse in the city's Old Town section. He cut off the fee Oct. 1, he said this week, following the publicity.

Williams defends the per diem, noting that Carter administration officials who handled his 1980 nomination to the federal bench promised him in writing that his duty station would be Richmond.

He even met with architects from the General Services Administration about building a new courtroom and chambers in Richmond, he said.

Williams' plans were short-circuited last year when another Carter nominee, Richmond Circuit Judge James Sheffield, ran afoul of the Senate nominating process and failed to win confirmation. Williams was reassigned to Alexandria to take Sheffield's place.

Despite Williams' wishes to return south, the way apparently is blocked by a so-called "local rule," agreed to last fall by eight judges in Virginia's eastern district. The rule sets the number of active judges assigned to Richmond at two and those in Alexandria at three.

The Richmond slots already are filled by Robert A. Merhige Jr. and D. Dortch Warriner. A federal judge in Norfolk, J. Calvitt Clarke, is rumored to be interested in Richmond, too, and would outdistance Williams in terms of seniority.

Meanwhile, Williams may have victimized himself by performing too well on the job. Bryan, who assigns the cases in Alexandria, reportedly likes Williams and would prefer that he stay put--if only to lighten the burden on the aging Lewis.

The district's chief judge, John MacKenzie of Norfolk, agrees. "Judge Lewis has a certain quality of outspokenness that the modern scene can use," says MacKenzie. But Williams will keep his current assignment, sharing the case load, MacKenzie says, until the quota of three active judges for Alexandria can be filled by yet another new appointment.

A federal judgeship bill that would create more judicial slots is now stalled on Capitol Hill.

Unless his colleagues agree unanimously that a move by Williams to Richmond is called for--which looks unlikely--Williams says he'll follow the course that many another citizen takes: tell it to the judge.

A Judicial Council, composed of five U.S. appeals court judges and four from the district courts, would resolve the issue if requested.

"I think they're acting like little children," says one Northern Virginia judge-watcher with a shake of the head.