The boss of the Chicago Mafia once described Roy Lee Williams as the Teamsters union official he relied on "if we need a favor" from the union, a federal court judge was told today at a sentencing hearing.

The testimony, citing the words of Joseph Aiuppa, head of Chicago's La Cosa Nostra, came from James (Jimmy the Weasel) Fratianno, 69, the highest-ranking Mafia member ever to become a government witness.

Federal prosecutors produced him amid tight security at the start of hearings aimed at showing the organized-crime connections of Williams, now Teamsters president, and several of the others convicted with him in December. One defendant, Chicago insurance executive Allen M. Dorfman, was shot and killed in a gangland-style execution Jan. 20.

Williams, reputed Chicago mobster Joseph (Joey the Clown) Lombardo and Teamsters Central States Pension Fund officials Amos Massa and Thomas O'Malley are to be sentenced later this week for having conspired to bribe then-Sen. Howard W. Cannon (D-Nev.).

Justice Department prosecutors are trying to persuade U.S. District Court Judge Prentice H. Marshall to impose stiff sentences on Williams and Lombardo and to order Williams to give up his $225,000-a-year post as Teamsters president.

Fratianno, an admitted killer who turned government informant in 1978, said Aiuppa described Williams as the Chicago crime family's best ally in the union during a conversation in the mid-1970s.

At the time, Fratianno said he had been trying to put together a lucrative dental program for about 8,000 Teamsters members in the San Francisco area. He said he had made preliminary arrangements with Dorfmman for such a program to be administered out of Warren, Ohio.

But Dorfman, a protege of the late Teamsters boss James R. Hoffa, "was on the outs" with the Teamsters hierarchy in Ohio at the time, Fratianno said. Fratianno said he managed to patch things up by returning to Cleveland, his hometown, for a meeting with Jackie Presser, the union's international vice president based there.

Presser "told me to tell Allen Dorfman that 'he got my blessings,' " Fratianno said, and he conveyed the message on a return trip to Chicago.

Lombardo, described by the FBI as the man who "controlled" Dorfman for the Chicago mob, took Fratianno to dinner on the same trip and introduced him at the restaurant to Aiuppa and his "underboss," Jackie Cerone, Fratianno said.

Aiuppa was upset that Fratianno had not gotten his explicit permission to deal with Dorfman, the court was told. Fratianno said he told Aiuppa that he thought he had gotten clearance and then recounted his meeting with Presser.

"He [Aiuppa] told me, 'You know I don't like Jackie Presser. We use Roy Williams and [reputed Kansas City crime boss] Nick Civella if we need a favor.' "

Williams was a Teamsters international vice president in Kansas City at the time. A Justice Department memo once described him as "under the complete domination of Civella."

Lombardo, being held in lieu of $2.5 million bail, grinned several times as defense lawyers pressed Fratianno for details of Mafia rules and rituals.

Testifying calmly, the witness recounted other meetings with Lombardo, including one at which he said a Chicago mobster just out of prison, Marshall Caifano, was complaining because the man who had testified against him "wasn't No. 1 on the hit parade" of people marked by the Chicago Mafia for execution.

"Joey Lombardo said, 'Don't worry about it. It will be taken care of,' " Fratianno testified.

Ray Ryan, about whom Caifano had complained, was killed in October, 1977, when a bomb demolished his car in the parking lot of an Indiana health spa.