Sen. Howard W. Cannon (D-Nev.) acknowledged today that he worked hard to prevent assignment of trucking deregulation legislation to a rival Senate committee, but he denied that his efforts were prompted by a deal with the Teamsters union.

Cannon completed his testimony in federal court here this afternoon after declaring that he had simply been trying to uphold the prerogatives of the Senate Commerce Committee in gaining jurisdiction over the legislation, strongly opposed by the Teamsters.

The government has charged that Teamsters union president Roy Lee Williams and four colleagues conspired to bribe Cannon Jan. 10, 1979, by promising him a cut-rate price on a piece of Las Vegas real estate in return for help in squelching an anticipated deregulation bill.

Repeatedly claiming a dim memory about the Jan. 10 meeting in his office, Cannon said he did mention at one point that he and his neighbors were bidding on the 5.8-acre tract in question.

The property was then owned by the Teamsters Central States Pension Fund, and Cannon's group wanted to protect it from high-rise development.

Cannon said he mentioned the homeowners' bid to Chicago insurance executive Allen Dorfman, a longtime Teamsters union associate and a participant at the meeting in Cannon's office.

Under cross-examination by government prosecutor Douglas Roller, Cannon said he could not remember any previous conversation with Dorfman about the property. Roller professed puzzlement, wondering how Dorfman could have known what Cannon was talking about.

"He might not have," Cannon replied. The senator said he could not recall any reply by Dorfman.

Cannon, defeated Nov. 2 in his bid for a fifth term, underwent respectful, almost gingerly, cross-examination, and his testimony repeatedly conflicted with accounts of other witnesses.

The head of the homeowners group, Las Vegas investment banker Vernon G. Willis, testified last month, for example, that Cannon had told his neighbors that he would "call Dorfman to see if we could purchase the property directly from the owner."

Cannon denied that, saying: "I never told Mr. Willis that I was going to call Mr. Dorfman."

Roller also questioned Cannon about several damaging statements made by Dorfman and Williams and secretly tape-recorded by the FBI during the 1979-80 investigation that led to the indictment.

In a conversation April 26, 1979, Williams told a Dorfman associate that he wanted to find out why the property deal had not gone though " 'cause I got whistled in by the senator . . . to find out what was wrong and, of course, I know what he done with deregulations. He put 'em on the back burner."

Cannon swore that never talked to Williams after Jan. 10, 1979 and "never saw him after that date" until this week in a courtroom corridor.

"So, when Mr. Williams said on April 26, 1979, that he was 'whistled in' by the senator, he was clearly wrong?" Roller asked.

"He certainly was," Cannon responded.

Similarly, Cannon was questioned about a Nov. 20, 1979, conversation in which Dorfman told a colleague he had known Cannon for 30 years, gave him "his first money to go into office" and used to be able to go to him from time to time.

In the past, Dorfman recounted, Cannon would respond: " 'A favor,' he says, 'Allen, you've got it.' " But now, Dorfman asserted, "he ain't talking to me anymore" because of the Teamsters' failure to deliver the Las Vegas property.

The senator denied making such remarks to Dorfman. He said it was untrue that Dorfman had given him a campaign contribution. "He not only never gave me any 'first money,' he never gave any money," Cannon said.

Cannon acknowledged having been warned by government prosecutors that he "could become a subject" of federal grand jury action. Prosecutors here reportedly recommended his indictment, but Justice Department officials in Washington did not feel it was warranted.

Cannon's group never acquired the property in question, and he ultimately sponsored the deregulation measure enacted by Congress in 1980.