One of the most prominent northern Democratic supporters of President Reagan's conservative economic and social policies went down to defeat yesterday, as Massachusetts Gov. Edward J. King lost his bid for renomination to former governor Michael S. Dukakis.

On a day of victories for moderates and liberals in many states, Dukakis reversed his 1978 loss to King by a narrow 53-to-47 percent margin. He thanked his supporters for giving him "a second chance," and said his win was "a defeat for Reaganomics" that should be heeded "across the entire country."

Critics of Reagan's arms policies were cheered by the endorsement of a nuclear freeze resolution on the Wisconsin ballot, the first such statewide vote this year.

In another victory for moderates, Sen. Robert T. Stafford (R-Vt.), a target of business and conservative criticism for his championship of environmental legislation, won renomination over two challengers. Former secretary of state James Guest won the Democratic senatorial nomination.

As Stafford used his chairmanship of the Senate Environment and Public Works Committee to advantage, another veteran committee head, House Foreign Affairs Chairman Clement J. Zablocki (D-Wis.), exploited his prestige to turn back a serious primary challenge from state Sen. Lynn Adelman.

The fate of another Capitol Hill veteran, Sen. Howard W. Cannon (D-Nev.) was not clear early today.

Cannon narrowly trailed his younger opponent, Rep. James D. Santini (D-Nev.), in early returns, and led by 140 votes later, with 54 percent of the vote counted. Santini is a "western Boll Weevil," a frequent supporter of Reagan's economic and budgetary policies. The King-Dukakis battle was perhaps the highlight of the busiest primary election day of the year, with voters in 12 states and the District of Columbia picking nominees.

Former Boston city councilman John W. Sears was the winner of a three-way Republican primary to oppose Dukakis in Massachusetts. Dukakis' victory was aided by late campaigning by Sen. Edward M. Kennedy (D-Mass.), who was unopposed for renomination.

But others attempting comebacks had less luck. In Minnesota, former governor Rudy Perpich appeared to be losing the Democratic nomination for his old job to state attorney general Warren Spannaus, a political protege of former vice president Walter F. Mondale. Spannaus appeared likely to face Republican businessman Wheelock Whitney, who defeated Lt. Gov. Lou Wangberg, the choice of retiring Republican Gov. Albert H. Quie.

In the Minnesota Senate race, Republican Sen. David F. Durenberger is matched against millionaire Mark Dayton, who easily thwarted the comeback hopes of former senator Eugene J. McCarthy in the Democratic primary.

In Wisconsin, where another governorship was vacated by the retirement decision of Republican incumbent Lee S. Dreyfus, businessman Terry Kohler (R) won the expected GOP primary victory over Lowell Jackson, a Dreyfus cabinet member and an early Reagan supporter.

But in the Democratic primary, former legislator and natural resources administrator Anthony S. Earl was virtually tied with former governor Martin J. Schreiber for the nomination. With the possible exception of the Santini-Cannon race, the victories in most of the contested primaries yesterday went to Democrats and Republicans who were more moderate or liberal than their opponents.

In many cases the winners had the support of labor, liberal and environmental groups in their states. But, as always is the case in primaries, individual appeal, financial support and organizational resources had as much to do with the outcome as any of the issues.