Roy Lee Williams, the ailing ex-president of the Teamsters union, testified today in compelling detail about the Mafia's domination of his union and how he himself came to be controlled by the crime boss of Kansas City.

"We tried to meet at least once a month, sometimes oftener," the 70-year-old Williams recalled of his dealings with the late Nick Civella, the reputed Mafia chieftain who died in 1983. "He told me not to deal with anyone else who would try to contact me."

Struggling to stay out of federal prison himself, Williams took the stand today as a government witness at the trial of nine reputed Midwestern crime bosses and their associates on charges of skimming $2 million from a string of casinos they secretly controlled in Las Vegas.

His testimony, in addition to providing details about the alleged skimming arrangement, offered a unique glimpse of the relationship between individual Teamsters leaders and Mafia figures that has been widely discussed but rarely documented by an insider such as Williams. Williams is the third Teamsters president since 1957 convicted of a federal crime, but the first ever to testify in open court.

Convicted in 1982 of conspiring to bribe a U.S. senator, Williams was supposed to start serving a 10-year prison sentence earlier this month, but the date has been postponed. One of the defendants, Carl DeLuna, 56, for years Nick Civella's right-hand man, glared at him when the former Teamsters boss pointed him out in the courtroom.

Williams, who rose in Teamsters ranks under the tutelage of Jimmy Hoffa, said he first met Civella in the early 1950s when they served together on a committee of "referees" to sort out the flood of Democratic candidates for public office here and give the nod to the ones "we thought we could win."

Civella, Williams said, "was a very deep thinker. We were very close."

Gaunt, perhaps 30 pounds lighter than when he stood trial in Chicago, Williams said he and Civella began to help each other from then on. Williams never used the word "Mafia," but simply said that Civella "represented a powerful group here in Kansas City" with influence that extended throughout the United States.

"He knew many of my superiors in other parts of the country," Williams testified. "He knew Mr. Hoffa. He knew Mr. Bill Presser . . . . If there was any argument between he and I, somehow my superiors would find out about it and ask me to comply with his request."

By 1974, Williams was an international Teamsters vice president and a trustee of the Teamsters Central States Pension Fund, receiving a $1,500-a-month payoff for helping to arrange a loan from the fund to a string of casinos in Las Vegas secretly controlled by Midwestern crime bosses. The casinos are the focus of the trial here.

Williams said the first he knew about the $62.75 million loan was when Nick Civella told him about the application that was about to be made for it.

"He told me there was a loan coming in, he didn't know just when, to the committee" at the Pension Fund in charge of such applications, Williams said. He said Civella told him "to follow the 'Plug's' lead."

" 'Plug' was Teamsters international vice president Bill Presser," Williams explained, referring to the late father of union leader Jackie Presser. "He was chairman of the special committee . . . . Nick understood that Bill's friends in Cleveland had talked to him."

In July, the Justice Department dropped a 32-month labor fraud probe of Jackie Presser, currently the president of the Teamsters, the only major union to endorse President Reagan in 1980 and again last year.

Williams, brought to the courtroom in a wheelchair with plastic tubes running from his nostrils to an oxygen tank, testified in a strong voice, sometimes interrupted by a racking cough from an acute case of emphysema. But those who know him said the words came hard for him.

"He's only been talking to the FBI for a few weeks," one source said. "It's still very difficult for him. It goes against the way he grew up. But he's convinced that he'll die if he goes to prison."

Williams told how DeLuna and others in the Kansas City mob used to refer to him, although not to his face, as "Rancher" or "Truck." These were the code names used on a number of payoff memos seized by authorities at DeLuna's home and elsewhere.

According to other reports, Williams' $1,500 a month was small change compared to what former Teamsters president Frank Fitzsimmons and Bill Presser are supposed to have gotten for the loan to buy two of the casinos in question, the Stardust and the Fremont. Former Cleveland Mafia under- boss Angelo Lonardo, who is also expected to testify, has reportedly told the FBI that Fitzsimmons and Bill Presser -- nicknamed "Plug" or "Fireplug" by Jimmy Hoffa -- got $600,000 for using their influence in lending the funds to a mob-backed businessman.

According to Williams, people like Civella guarded contacts like Williams jealously. Williams said Civella would send messages and the $1,500 a month through only one man -- Teamsters organizer Sam Ancona. Over the years, Williams said, men such as the late Alan Dorfman of, the Chicago mob, would "ask me to meet this man or that man or some other man. I would say, 'You know where you got to go. You got to see my friend in Kansas City.'