The captain of a TWA passenger jet seized for 17 days in 1985 testified Monday Lebanese defendant Mohammad Ali Hamadi was the hijacker who killed U.S. Navy diver Robert Stethem.

In a slow and labored voice, John L. Testrake, 61, of Richmond, Mo., described the severe beatings of Stethem and flight engineer Christian Zimmerman by Hamadi and his accomplice.After a brief pause in the morning session, the pilot of ill-fated Flight 847 came back and told the Frankfurt juvenile court he had for the first time gotten a good look at Hamadi during the court's recess.

He said he believed Hamadi was the Shiite radical who shot Stethem to death at Beirut airport on the second day of the 17-day siege in June 1985. Stethem, a U.S. Navy diver, was dumped on the tarmac of the airport.

Hamadi admitted in court in August that he helped hijack the Trans World Airlines flight to Beirut to force the release of Shiite Moslems held in Israel. But the defendant said he was just taking orders and blamed the killing of Stethem on his accomplice, who is at large.

Kurt Carlson, an American passenger aboard the flight, testified last week he believed Hamadi was in charge because he gave the orders to his wild-eyed accomplice.

Also last week, another American Peter Hill testified that Hamadi "gloated" over the shooting death of Stethem in conversations with passengers.

Under West German law, Hamadi may be convicted of murder if he knew the slaying was to take place and approved of it.

Testrake, asked by the five-judge panel to comment on Hamadi's claim he was only taking orders, said: "Either his memory is faulty or he is lying."

Hamadi, who may be sentenced to life in prison if convicted, is standing trial for air piracy and murder. He was apprehended in Frankfurt in January 1987 as he carried explosives into Germany after flying in from Beirut.

Bonn refused to extradite the Lebanese man to the United States for fear retaliation would be taken against West German hostages in Beirut.