Sen. Paul S. Sarbanes' victory yesterday over Republican Lawrence J. Hogan handed a stunning defeat to the senator's second opponent--the National Conservative Political Action Committee, which had spent 20 months and $650,000 to get the liberal Marylander out of the U.S. Senate.

Voters apparently ignored the message, repeated in a final blitz of 222 commercials in the campaign's closing days, that Sarbanes "is too liberal for Maryland."

"There is no better example in the country of how a NCPAC campaign backfired," said Evan Zeppos of the Democratic Congressional Campaign Committee. "The race is a classic on how Democrats should approach these attacks."

For their part, NCPAC officials have said repeatedly that they would not be embarrassed by a Sarbanes victory and were happy to have placed Sarbanes' record before the public. "If that's what the voters of Maryland want, then that's what they'll get," said NCPAC political director Vic Gresham.

From the day in April 1981 when NCPAC chairman John T. (Terry) Dolan unveiled the group's first anti-Sarbanes television commercial and asserted that the liberal Sarbanes would be NCPAC's number-one target, the New Right attack boomeranged.

In some instances, NCPAC turned Sarbanes' minuses into pluses. It galvanized his friends and divided his foes. It got the reluctant candidate on the campaign trail 20 months before the election, and enlivened his ponderous speeches. Some said it even turned what Republicans insisted was Sarbanes' vulnerability -- low name recognition and a fuzzy image -- into an advantage.

"When a person not that well known is subjected to this kind of pressure from outside," said Democratic pollster Peter Hart, "he becomes a sympathetic figure."

And where the NCPAC attack could have hurt, Sarbanes fought back, taking his cue from politicians who suffered through NCPAC's 1980 onslaught.

Former Idaho senator Frank Church, one of the prominent liberals whom NCPAC takes credit for defeating in 1980, said he told Sarbanes "early on, not to underestimate the threat they represented and certainly not to ignore it." Sarbanes took his friend's advice.

Sarbanes started within his own party, according to press aide Bruce Frame. He solidified support among Democrats, many of whom later traveled across the state telling voters that Sarbanes' election was the "most important" they would vote in this year.

The low-key Sarbanes, who dislikes long campaigns, also began fund-raising in 1981. He traveled the country, sometimes taking part in group fund-raisers for several candidates under attack by NCPAC, at other times relying on his own friends and supporters. Everywhere, NCPAC was the selling point. It was mentioned in all his mail solicitations, and when millionaire sportsman Abe Pollin asked friends to donate $500 each to Sarbanes campaign, Pollin's letter told them: "As you know, Sen. Sarbanes is being attacked . . . ."

By the end of the campaign, Sarbanes had raised and spent about $1.5 million.

Sarbanes officially opened his reelection campaign on June 28, abandoning his normal reserve and denouncing New Right "extremist groups" for what he called campaigns of "distortion and manipulation."

"We have an opportunity in 1982 to send a message not only across Maryland but across the nation that these groups should depart and depart now from our politics," Sarbanes told his enthusiastic audiences.

It was a theme that would be sounded again and again, and one that was familiar to at least one of NCPAC's previous targets -- Sen. Thomas F. Eagleton (D-Mo.), one of two senators to survive NCPAC targeting in 1980.

"When NCPAC came in, they wanted to raise their issues," said Mark Abels, an Eagleton aide in 1980. "But it is always good to set your issues, and we decided when they came in that they would be the issue."

Sarbanes successfully made NCPAC a major issue in his race with Hogan from the moment the two men walked into a WMAL radio booth in Northwest Washington for their first debate. In an angry exchange, Sarbanes charged that Hogan had failed to prevent NCPAC from manipulating the political process. "You could get those people out of the state if you wanted to do it," Sarbanes shouted at Hogan.

After several minutes, the exasperated Hogan shot back: "You're trying to wrap NCPAC around my neck."

That is precisely what was prescribed by several of NCPAC's 1980 targets. "Tie NCPAC to your opponent," said Peter Fenn, who was Church's campaign manager in 1980. "I think that was done effectively by Sarbanes. Hogan was stuck explaining NCPAC and justifying his position."

If Sarbanes wanted it, there was plenty of aid and counsel around on how to deal with NCPAC. From the Democratic Senatorial Campaign Committee came a paper titled, "The Politics of Negativism," which Sarbanes aides read. From the Eagleton camp came a pyramid-style plan to amass an army of volunteers, which the Sarbanes campaign adopted. From a group called Democrats for the '80s came $20,000 worth of radio advertising, aimed at NCPAC and aired in Baltimore and Washington.

Through it all, Sarbanes remained true to his style of gathering reams of information on NCPAC and analyzing it. After that, the tactics Sarbanes rejected were as important to his winning campaign as those he followed. Sarbanes did not debate NCPAC's Dolan, as some newspapers and television stations invited him to. Sarbanes did not respond angrily to NCPAC's attacks on his record. Sarbanes declined to go after NCPAC in his own television commercials, although some consultants counseled him to do so.

The senator was fortunate to be running against NCPAC now rather than two years ago, according to many observers. "The country has begun to shift back to a more moderate stance," said Fenn. "There is not a tidal wave of conservativism as there was in 1980. NCPAC's tactics are more widely known . . . and candidates have the experience of 1980 to teach them how to handle it."