Baltimore County Executive Donald P. Hutchinson formally quit the Senate race today with a sharp parting attack on U.S. Rep. Michael D. Barnes, whom he characterized as a political opportunist seeking to exploit racial tensions to aid his own Senate campaign.

"I make no political endorsement. Suffice it to say that I strongly suggest to the citizens of Maryland that they not elect Michael Barnes to the U.S. Senate," Hutchinson said, as reporters and staff members fell into a surprised silence. Later, expanding on his remarks, he said, "It seems to me he will play to any kind of a crowd he happens to be in. I do not respect that in a politician."

Barnes, apprised later of Hutchinson's comments, said he was surprised and defended his campaign.

Hutchinson would not say whom he prefers between the other two Democratic contenders for the Senate seat, Gov. Harry Hughes and the acknowledged front-runner, Rep. Barbara A. Mikulski of Baltimore, whose popularity he said he originally had underestimated. His belated recognition of Mikulski's strength, even in his home base, came after months of campaigning and an expensive television campaign and led to his decision to drop out of the race, he said, adding that "It is hard for me to determine . . . how Barbara Mikulski can lose this race."

Hutchinson, whose pointed criticisms of his rivals became an early and somewhat controversial feature of his eight-month campaign, blunted some of his barbs today. He called Hughes, whom he had earlier characterized as "finished" politically, "a friend" who has "served the people of the state well."

But today's attack on Barnes, a Montgomery County lawyer first elected to the Congress in 1978, was one of the most blistering of the campaign. It stemmed from two things, Hutchinson said:

"At the very first debate I had with Congressman Barnes in Prince George's County, comments were, 'It's time Montgomery or Prince George's elected a senator. Baltimore doesn't need everything.' " It's quite clearly trying to create a division along geographic lines. I also think he is trying to create a divisive situation racially in this state by attacking Barbara Mikulski's vote on tuition tax credits . . . which is an unfair and unwarranted attack."

The latter reference was to Barnes' decision to highlight several of Mikulski's votes in an effort to chip away at her support in the Baltimore area, particularly among blacks. Barnes has made special efforts to highlight Mikulski's votes for amendments that would have helped private and, in some instances, segregated schools, a tactic Mikulski has angrily called "a smear campaign."

Today Barnes, saying he was surprised at Hutchinson's "misunderstanding" of his campaign, defended himself on both counts.

"I think the reality is that my campaign offers an appeal to help unite the state. If I am elected I will be the first statewide oficial elected from the Washington suburbs since 1913," Barnes said, noting that all other candidates from top state offices are from Baltimore. "I've just made the point that we can help pull our state together by bringing broader representation. I haven't seen that as being a divisive argument.

"Secondly, on the issue of racial divisiveness, my campaign has been one that has worked to unite the state . . . . I am reaching out to include all the people of Maryland." He cited as evidence his selection of a black campaign manager.

Asked if Hutchinson's comments would hurt his campaign in Baltimore County, Barnes paused and said, "We'll see. But I think people are fair-minded and will make their own judgment."