Updated

By Peter Henderson

SAN FRANCISCO (Reuters) - Athletes, including former baseball all-star Jason Giambi, will be allowed to testify about getting steroids from Barry Bonds' trainer when the perjury trial of Major League Baseball's home run king begins in March, a federal judge said on Friday.

But U.S. District Judge Susan Illston dashed prosecutors' hopes of introducing calendars and coded drug tests they say link Bonds, 46, to steroid use. She had previously thrown out the evidence as hearsay and a new government argument for its inclusion failed to convince her.

Looking fit in a dark suit, Bonds smiled as he entered and left the courtroom and chatted with a lawyer while waiting for the judge to take the bench. More than 20 lawyers from both sides appeared in the courtroom.

Bonds passed Hank Aaron to become Major League Baseball's career home run leader in 2007, but the record was tarnished the same year by a federal indictment charging that the slugger lied about use of performance-enhancing drugs. Bonds also holds the single-season home run record of 73.

The San Francisco Giants did not renew his contract after the 2007 season and baseball's image was sullied by the BALCO affair, named after the lab associated with the drug scandal.

Prosecutors plan to call Bonds' former trainer, Greg Anderson, one of those who went to jail in connection with the case, but Anderson has indicated he will not testify.

Illston said, however, she would allow athletes to describe their dealings with Anderson, which the government hopes will convince a jury that Bonds was in on the action.

A government witness list includes Bonds' former teammate Benito Santiago, along with Giambi, a former slugger for the Oakland Athletics and New York Yankees, and his brother and former teammate Jeremy Giambi. The list indicates they will testify about getting performance-enhancing drugs from Anderson.

"This is guilt by association," Bonds' attorney Dennis Riordan said.

"All things equal, it would be OK for them to testify," Illston responded in her preliminary ruling from the bench, saying it was relevant to judging the truth of Bonds' testimony.

The trial, scheduled to begin March 21 and last two weeks or more, may be full of unusual evidence -- the government, for instance, hopes to introduce testimony on the size of Bonds' testicles to prove they were shrunk by use of steroids.

U.S. prosecutors declined to discuss the hearing. Bonds' lawyers cast it as an outright victory, since Illston quashed the government's new attempt to bring in the calendars and testimony related to them.

The case in California Northern District Federal Court is 07-cr-00732.

In another case tied to performance-enhancing drugs, lawyers for former baseball pitching star Roger Clemens asked a federal judge on Friday to throw out charges he lied and obstructed a congressional probe into whether he used such substances.

(Editing by Peter Cooney)