U.S. District Court Judge Abraham D. Sofaer, who presided over the trial stemming from Ariel Sharon's libel suit against Time magazine, has agreed to leave the bench to become legal adviser to the State Department, according to department officials.

Sofaer had indicated a desire to leave the federal bench because he felt the "action" was moving to state courts, according to friends.

He reportedly had been a candidate for a seat on the New York Court of Appeals, the state's highest court, before receiving the offer of the top legal job at the State Department from Secretary George P. Shultz. The White House must approve his appointment, which has not been announced, and he must be confirmed by the Senate.

He would replace Davis R. Robinson, who oversees about 85 lawyers. The office of the legal adviser has been criticized in some quarters for its handling of controversial matters before the World Court.

Sofaer, a former law professor at Columbia University, won praise for his innovative approach in the case of the former Israeli defense minister. Among other things he asked the jury to return separate findings on each of the crucial questions involved in a finding of libel.