A not-so-funny thing happened to William L. Dwyer on his way to becoming a federal judge.

And another, and another and another.

Dwyer, you may recall, was the liberal Seattle lawyer whom the Reagan administration had stalled for months on nominating to the federal district judgeship for which he had been proposed.

Stalled, that is, until Washington Sen. Slade Gorton (R) executed the switch-in-time that saved the nomination of Daniel A. Manion, the administration's controversial pick for an appeals court judgeship in Chicago.

Gorton traded his vote for Manion -- confirmed 50 to 49 in July 1986 -- but lost his Senate seat in the ensuing uproar.

The administration, as agreed, nominated Dwyer. Then, the Democrats, many of whom felt double-crossed by Gorton's vote trade, got into the action.

Last October, they used a routine procedural objection to strike Dwyer's name from a Judiciary Committee list of judicial nominees awaiting confirmation, and for a time the nomination looked dead altogether. The administration, figuring it had lived up to its end of the deal, balked at nominating Dwyer again, as is required after a congressional recess.

Then, a few months later, Sen. Daniel J. Evans (R-Wash.) put a hold on Senate action on all nominees from the 9th Circuit, the judicial circuit that includes Washington state, and Dwyer's chances of becoming a federal judge magically revived. He was nominated for the second time on July 29, and was the subject of a committee hearing last month.

Now, Dwyer has hit another bump on his rocky road to the bench. This time around, Republicans have been raising questions about the 58-year-old lawyer.

Sen. Strom Thurmond (R-S.C.) demanded a second hearing on Dwyer to address questions raised about advice he gave, as a lawyer for the Seattle Public Library board in 1985, that the library's possession of a childrens' sex education book called "Show Me!" did not violate state or federal pornography laws.

The book contains explicit photographs of minors engaging in various sexual acts. Thurmond, leafing through it during the second Dwyer hearing yesterday, assailed the book as "repugnant," "offensive," and "simply indecent," and none of the witnesses appearing for or against Dwyer appeared inclined to disagree.

Dwyer, testifying for the second time, said " 'Show Me!' is not a book I would have in my house," adding, "I feel strongly against its use."

However, he defended his advice as a correct legal interpretation.

The five-hour session focused as much on the book as it did on Dwyer. "We have had a lot more debate about a book we all find offensive than we have about your credentials," Sen. Patrick J. Leahy (D-Vt.) told Dwyer.

During the hearing, conservative legal scholar Bruce Fein criticized Dwyer for a 1984 book that criticized, among others, Thurmond and President Reagan, the man who has twice nominated him for the bench.

Dwyer, under questioning by Thurmond, not only defended his statement that Reagan, in the early 1960s, was among those who gave support to far-right-wing groups -- "I would be glad to change my mind, except that what I wrote was true," he said -- but revealed that he voted in 1980 and again in 1984 for Reagan's opponents. Dwyer also said he had made a campaign contribution to Walter F. Mondale in 1984.

The questioning finally ended at 7 p.m., and Leahy announced his hope to hold a vote on Dwyer next Thursday.

Sen. Charles E. Grassley (R-Iowa) suggested during the session that the Democrats were now getting their just desserts for their attack on Supreme Court nominee Robert H. Bork. "There's an old saying that chickens come home to roost," he said. "We've got old statements and writings of Mr. Dwyer being cited as evidence" that he should not be confirmed. "We had the same thing happen to Judge Bork," Grassley said.