Senator Edward W. Brooke (R-Mass.), the nation's only black U.S. Senator, appeared early last night to be withstanding a strong challenge in the Republican senatorial primary here from conservative talk show host Avi Nelson.

State Republican Party Chairman Gordon Nelson predicted early last night that Brooke would win the race with 55 percent of the vote.

Republicans, bolstered by independents and Democratic switchovers, apparently shed their traditional conservatism yesterday to save the state Republican Party's only top officeholder and proven vote getter.

With first returns trickling in, Massachusetts Secretary of State Paul Guzzi and Rep. Paul Tsongas (D. Mass.) were leading the pack of five in the Democratic senatorial primary.

In the gubernatorial race here, conservative Edward J. King was narrowly leading Gov. Michael S. Dukakis in the Democratic primary. On the Republican side, House Minority Leader Francis Hatch appeared to be winning.

The liberal Brooke, who had personal and political problems stemming from his bitter divorce, was leading in Boston, which was said to be the stronghold of the Nelson campaign.

"I don't think the divorce was significant," Chairman Nelson said.

Many people were resentful at the lynching party by the media and voted sympathetically for Brooke."

Beside, even conservative Republicans came out for him because he's a proven winner and we need to keep that Senate seat for the Republican Party in Massachusetts," he said.

The sharply contested senatorial and gubernatorial races, together with the local contests and a sunny autumn day, drew a heavy voter turnout across the state - which observers here predicted would swing more of the votes behind incumbents Dukakis and Brooke.

In the Republican primary, intensive efforts by both Brooke and Avi Nelson toget Democrats to switch over to Republican registration seemed to be a key factor in drawing large GOP turnout at the state's 2,201 polling places.