Former Green Beret Eugene Tafoya, accused of attempting to murder a Libyan student here last year, today denied charges he was a mercenary hired by the Libyan government to assassinate political opponents of Col. Muammar Qaddafi.

And, after three weeks of testimony in Tafoya's trial, the name of Edwin P. Wilson, a former CIA agent accused of masterminding a plot to kill Libyan dissidents in the United States, finally was put before the jury.

Tafoya acknowledged working for Wilson in Libya in 1979 and 1980. But he said he believed he was working for the CIA, not Wilson, when he shot Faisal Zagallai, a leader of Libyan students in the United States who oppose Qaddafi, twice in the head on Oct. 14, 1980. Tafoya has said he shot Zagallai in self-defense.

Tafoya, 43, said he applied for a job with the CIA in May, 1976, following his discharge after 23 years in the Army.

He said his resume detailed his military service, including work he did at the direction of the CIA during five years in Vietnam as a member of the Special Forces. But the CIA turned him down after an interview, he said.

Disappointed, Tafoya went back to Truth or Consequences, N.M., and worked in construction and as a demolitions expert on a pipeline project, he said.

In early 1979, he said, he received a telephone call from someone asking "whether I was still interested in working in the same capacity as I had in the Special Forces." A meeting was arranged with a man named "John" and another "who spoke with a foreign accent," who said they worked "for The Company," Tafoya testified.

He did not specify the date or place of the meeting. But in previous statements to reporters he has said he met the two men in Toronto.

"John seemed to know everything about me," Tafoya said. "He had information that could only have come from my resume to the CIA."

Tafoya said the two men displayed credentials that satisfied him they were with the CIA. They did not offer him a job then, he said, but "John" later contacted him and instructed him to go to Libya.

"It was my understanding I would be training troops there," Tafoya testified. He said he was told to report to Wilson, whom he later learned had been a CIA agent. Asked if he questioned whether Wilson was still employed by the agency, Tafoya said, "I never really thought about it."

The training classes never took place, Tafoya said. Instead he did "menial-type jobs: mechanics, running errands, delivering papers" for Wilson in the Middle East and Europe.

Although the CIA has denied that Tafoya was ever an employe, Tafoya said today that the entire time he was in Libya or serving as a courier for Wilson, his main employer was the CIA. He said he continued reporting on his activities to "John."

In September, 1980, Tafoya testified, he received a message from "John" that Zagallai "was making or preparing broadcasts endangering detente between Egypt and Israel."

Tafoya said he subsequently was instructed to contact Zagallai and "tell him to knock off the broadcasts."

There were no orders to kill Zagallai or harm him in any way, Tafoya testified. "Instructions were to make sure the message was understood," he said.

Tafoya said when he tried to deliver the message, Zagallai "erupted" in anger and pulled out a gun. Tafoya said he disarmed Zagallai, but that when he tried to leave the apartment, the Libyan grabbed Tafoya's gun and in the fighting it went off.

At no time, Tafoya testified, did he intend to kill Zagallai or harm him.

Tafoya acknowledged receiving money from both Wilson and "John." But the money received from Wilson--including $8,623 after the shooting of Zagallai--was "mostly expenses for delivering papers and junk like that," Tafoya said.

"Was that payment for anything you did for Ed Wilson in the United States?" Tafoya's attorney asked. "No," Tafoya replied.

On cross-examination, Tafoya admitted asking another former Green Beret in June, 1979: "Do you know anyone that should quit breathing? Permanently."

That taped conversation had been ruled inadmissible by Larimer County District Court Judge J. Robert Miller last week. But by taking the stand, Miller ruled today, Tafoya opened himself to questioning about the work he solicited after leaving the Army.

Defense attorney Scott Robinson said: "Had we known that the court was going to reverse its earlier ruling and allow into evidence statements which were previously suppressed because they were highly prejudicial and not material to this case, I can assure you we never would have advised our client to take the stand."

Miller refused to allow prosecutors to introduce a full transcript of the conversation, in which Tafoya also claims credit for the fire-bombing in May, 1979, of a car belonging to a Canadian businessman who had a falling out with Wilson over a deal to ship surveillance equipment to Libya. Libyan Convicted in Killing -Of Countryman in Utah City

OGDEN, Utah, Nov. 25 (AP)-- Libyan national Mohammed Shabata was convicted of second-degree murder in the death of a countryman whose bullet-riddled body was found in the trunk of a car.

Shabata, a 35-year-old former student at Weber State College, was found guilty just before midnight Tuesday by an eight-member 2nd District Court jury, which had deliberated more than eight hours.

Hours after the body of former student Nabil A. Mansour, 32, was found in the trunk of his car, Shabata was arrested in Chicago July 17 while on his way to Libya. The car was parked outside Shabata's Ogden apartment.

"This is absolutely not justice," a tearful Shabata told reporters as he was escorted by deputies into a jail elevator. "Justice is blind! Justice is blind! This is a game, not justice."

Defense attorney Robert A. Echard said he did not yet know if he would appeal the verdict.

The FBI investigated the case and reported it could find no evidence linking Mansour's death to a string of killings of Libyan dissidents in western countries.