Attorney General Edwin Meese III testified for five hours before a federal grand jury yesterday and is expected to be called back for further questioning about his conduct in the Wedtech scandal and dealings with E. Robert Wallach, a longtime friend who was a lawyer and adviser for the Wedtech Corp.

Outside the courtroom, Meese declined to respond when asked whether he thinks that he will be exonerated, but his lawyers said at day's end that they are confident the inquiry "will be concluded favorably to Mr. Meese."

Meese, under investigation by independent counsel James C. McKay since May, has indicated that his only familiarity with Wedtech dated to 1982 when, as counselor to President Reagan, he told aides to make sure that the Bronx company was given "a fair hearing" in efforts to win a $32 million Army engine contract. Wedtech won the no-bid award a few months later.

Wallach, threatened with indictment in the Wedtech scandal, had been a lawyer and adviser to the company since 1981 when he began seeking Meese's help in overcoming Defense Department resistance to the engine contract.

Meese's attorneys, Nathan Lewin and James Rocap, acknowleged in an interview Thursday night that Meese may also have discussed Wedtech at a meeting with Wallach in New York last December when the company was on the verge of collapse.

Wedtech then was under investigation by U.S. Attorney Rudolph W. Giuliani of New York and about to go into bankruptcy court to seek protection from its creditors.

Rocap and Lewin denied, however, that Meese would have told Wallach anything about the Justice Department investigation. Meese did not disqualify himself from the Giuliani inquiry until last April, and his failure to do so until then is one of the aspects of McKay's investigation under the Ethics in Government Act.

"I don't think Mr. Meese would deny the subject of Wedtech was brought up" at their New York get-together, Rocap said. He said that Meese "simply doesn't recall the substance of the meeting" but Meese was sure that there was very little discussion about the company.

The Meese-Wallach meeting occurred Dec. 11, 1986, the day after Wedtech's board of directors ended a short relationship with Dickstein, Shapiro & Morin where Wallach was "of counsel."

Wedtech had sent the law firm a $500,000 certified check for the services of a team headed by attorney Seymour Glanzer, but Dickstein Shapiro decided to return it, informed sources said.

According to one source, it was felt that the payment would look "too much like a preference" on the part of a bankrupt company for one of its creditors.

On Dec. 11, Wedtech hired a new law firm and, five days later, filed for protection under Chapter 11 of the bankruptcy code.

According to Lewin and Rocap, Meese's Dec. 11 meeting with Wallach was happenstance at the end of a Meese trip to Europe that included engagements in New York before he returned here.

"The timing of the meeting is not probative of anything," Lewin told a reporter. "Wallach simply happened to be in New York at the same time, and he simply asked if he could come over to see Mr. Meese at his hotel."

Asked whether Meese might have told Wallach about the Giuliani investigation, Lewin said "that absolutely did not happen. He would never have told Wallach anything about that."

In a brief encounter with reporters yesterday, Meese declined to comment on testimony by former Wedtech executive vice president Mario E. Moreno in Baltimore Thursday. Moreno said Wedtech made "illegal payments" of $300,000 to Wallach in expectation of his appointment to a Justice Department position.

"I won't be answering on any of these questions," Meese said when asked whether he had ever talked with Wallach about a Justice Department post.