James C. Cacheris looked around the packed courtroom in Alexandria's federal courthouse yesterday and acknowledged, "You don't win these judgeship races without a lot of help from your friends."

And most of his friends were present in the estimated crowd of 500 as Cacheris, a former Fairfax County Circuit Court judge, was sworn in as the newest member of the U.S. trial bench in the eastern half of Virginia.

"I don't know who all these people are unless they're your ex-clients," needled U.S. District Judge Oren R. Lewis after administering the oath to the 48-year-old Cacheris.

The 10-minute ceremony, presided over by federal Judge Albert V. Bryan Jr., had the earmarks of a Republican celebration for Cacheris, who 10 years ago became the first GOP state judge appointed in Virginia since Reconstruction.

Among those wedged into the normally spacious courtroom were 8th District Republican Rep. Stan Parris and Sen. John W. Warner, who recommended last summer that President Reagan appoint Cacheris to the judgeship.

"May I approach the bench?" asked Cacheris after being helped on with his black robe by former Fairfax County sheriff James Swinson. "He's learning fast," muttered Lewis, a 1960 Eisenhower appointee, to loud laughter from the spectators.

Cacheris was presented at the swearing-in by his brother, Plato, a Washington attorney. Plato Cacheris will be barred by court rules from appearing in cases before his brother. "This is the last time you'll hear me call you 'Your Honor,' Jimmy," he joked.

Lewis welcomed Cacheris as "our new junior judge. If anybody will welcome you with open arms, it's our current junior judge," he said, referring to Richard L. Williams, a former state judge from Richmond.

"If you'll just drop by my chambers afterward . . . " laughed Williams, who has made it known -- so far to no avail -- that he would prefer to be assigned to Richmond.