If anyone ever writes the textbook on how to fight the New Right, he could do no better than look at the reelection campaign of Sen. John Melcher (D-Mont.), a soft-spoken veterinarian from the tiny plains town of Forsyth.

Melcher, a moderate, has been slugging it out with the National Conservative Political Action Committee (NCPAC), the heavyweight champion of the New Right, for almost two years.

He has caught NCPAC dead wrong in its facts, has painted his opponent as a tool of right wing extremists and has convinced five of the 12 television stations in the state to stop running NCPAC ads.

Melcher forces have attacked NCPAC brutally in every round. They've called NCPAC a group of "political terrorists," circulated controversial statements by NCPAC Chairman John T. (Terry) Dolan, alerted TV station owners about NCPAC distortions, threatened legal action and lobbied for free time to respond to attacks.

"NCPAC has a record of smear tactics," said one ad given free air time. "Montanans deserve truth, not mud."

While Melcher has won these battles, he could lose the war. With the election less than a month away, he is one of the most endangered Democratic incumbent senators. And he blames many of his problems on NCPAC.

He says months of NCPAC television commercials have created doubts among voters about him.

"Negativism does work," he says. "It may not be appreciated by voters, but it causes an erosion. The negative idea sort of catches on that there must be something wrong with him, or they wouldn't be running all these commercials."

Much of Melcher's campaign has been directed at NCPAC. One commercial now being broadcast, for example, pictures two sinister-looking men leaving an airplane carrying thick, black NCPAC briefcases.

"For more than a year now a pack of East Coast politicos have been scurrying into Montana with briefcases full of money, trying to convince us that our John Melcher is out of step with Montana," a voice says as the briefcases break open, scattering stacks of money to the winds. "Montana isn't buying it, especially those who know bull when they hear it."

The scene shifts to a cattle pen, where a steer asks: "Did you hear about those city slickers bad-mouthing Doc Melcher?" Another steer replies that he thinks NCPAC has been "stepping in what they're trying to sell."

NCPAC has been a wild card in the Melcher race ever since two weeks after the 1980 election, when his name surfaced as a possible NCPAC target for 1982. It plans to spend $240,000 to $300,000 in the race, a huge sum in a state where $150 buys 30 seconds of prime-time advertising on a major station. In Washington that kind of time goes for about $4,500; in New York City, $11,000.

But many in Montana say they believe that NCPAC bumbled its chance to have a major impact on the race. Among them is Melcher's Republican opponent, Larry Williams, a personable financial consultant who ran unsuccessfully against Sen. Max Baucus (D-Mont.) in 1978.

Williams isn't a New Right conservative any more than Melcher is a far-out liberal. Williams supports legalized abortion, while Melcher opposes it. Many liberal environmentalists prefer Williams to Melcher because they say they believe he would be a stronger supporter of protecting wilderness areas.

Williams is a smoothie, a born salesman who calls himself a "libertarian populist." Author of a best seller called "How to Prosper in the Coming Good Years," he is campaigning as a true believer in supply-side economics who insists that good times are just around the corner.

He says NCPAC has "totally muddied" what he had hoped would be one of his best issues: a refusal to accept out-of-state campaign contributions. "They could have had a lot more impact if they wouldn't have been so clumsy," he said. Two examples:

* An NCPAC fund-raising letter said Melcher supported legalized abortion and voted for "giving away" the Panama Canal. NCPAC apologized when Melcher complained that he had voted against the Panama Canal treaties and federal funding of abortions.

* One NCPAC commercial pictured a middle-aged woman, who described herself as a "typical Montana conservative," calling Melcher a big-spending liberal. But it turned out that she had just moved to the state from California, wasn't registered to vote and had never heard of Melcher until she was asked to appear in the ad.

And some stations challenged the big-spending label by adding to the commercial: "We alert our viewers that the most recent analysis by the National Taxpayer's Union rates Sen. Melcher as an average spender."

Joe Lamson, executive secretary of the state Democratic Party, summed up the battle: "I think NCPAC thought it was coming into a backwater state where it could pick off a Senate seat at a bargain-basement price. But we've fought them tooth and nail."