Sen. Harrison A. Williams Jr. (D-N.J.) testified today that he was foolish not to walk out of a 1979 meeting with a phony Arab sheik when others present suggested he use his political influence to get government contracts for titanium.

"If I had given thought to what they were saying, as I am now, I certainly would have had to throw up my hands, say '. . . forget the whole thing' and walk out," the senator said in his second day on the witness stand at his Abscam bribery trial.

As his attorney, George J. Koelzer, replayed a government videotape of the June 28 meeting at an Arlington hotel, Williams recalled being disgusted, embarrassed and uncomfortable with the talk of influence peddling. But he said nothing about his misgivings at the time because he wanted to help friends get a loan for a Virginia mine that would produce titanium.

Williams and co-defendant Alexander Feinberg, a longtime friend, are charged with agreeing to trade the senator's influence in getting government titanium contracts in return for a $100 million loan from the "sheik" to develop the mine. The senator allegedly held a hidden 18 percent interest in the mining venture.

Williams has denied ever using his office corruptly. His attorney claims government agents manipulated conversations and "put words in his mouth" so the senator would make incriminating statements for secret cameras. Koelzer seems to be laying the foundation for an entrapment defense. But the senator said Wednesday that he ignored the blatant suggestions of undercover informant Melvin Weinberg moments before meeting the sheik, who was really an FBI agent.

The senator seemed to have increasing difficulty today explaining what he was thinking when he discussed getting government contracts and when he agreed that his interest in the mine would be concealed. For instance, Koelzer stopped the tape at a point where FBI agent Anthony Amoroso said that, in the senator's position, contracts would not be a problem.

Williams said on the tape: "No problem. No. In a situation where we can just sit around and describe, they'll see, it will come to pass."

When Koelzer asked him what he meant, the senator said, "Nothing particularly. It was just a general statement . . . I was being agreeable . . . it was just a session to impress the sheik."

At an Aug. 5, 1979, meeting, Williams accepted stock in corporations set up to develop the mine. But he said today he thought the stock was worthless and left it in an old travel bag his office desk for months, until he was confronted by the FBI early last year.

The senator said he thought later discussions about selling the partners' interest for a $50 million profit were "unrealistic." But he said, "I was not going to be the one to shut the door. I knew it was going to collapse. Let them find it out."

Williams continued his participation in the venture, however, flying to New York City for a Sept. 11, 1979, meeting of his friends and the supposed Arab investors, and even saying he would pay taxes on the profits. Weinberg had discussed hiding the profits in Swiss bank accounts. The senator explained today that even if the deal were meaningless he would still comply with the law.

"Not even loose talk would I be engaged in, that would suggest I would break any law or rule," he declared.

Williams also asserted today that he had never agreed to split $20,000 in expense money from the sheik with his friend Henry A. (Sandy) Williams III. Sandy Williams (no relation to the senator), who testified as a government witness to escape prosecution, said the senator didn't take the expense money only because he didn't want to accept it in person.

Koelzer's direct examination of the senator will continue Friday. Then chief federal prosecutor Thomas Puccio will get his chance to question Williams about the statements he made before the Abscam cameras.