Sen. Edward M. Kennedy (D-Mass.) has, for years, referred to his colleague, Sen. Edward W. Brooke (R-Mass.), as "the best politician in Massachusetts."

This year, Kennedy - among many other factors - is making Brooke prove it.

Brooke, who barely survived a challenge from a right-wing Republican in the September primary, come home Wednesday night fom his latest battle with the Senate Ethics Committee to receive a roaring welcome from supporters who jammed the ballroom of the venerable Copley-Plaza Hotel.

Looking back on the mouths of unending ugly publicity and official investigations of his tangled personal finances - the outgrowth of his divorce from his wife of many years and the embittered reaction of their daughters - Brooke said, "Every morning I've awakened and said, 'It can't be as bad as it was yesterday.' And every morning I was wrong. It was worse.

"But this morning I said it can't be as bad as it was yesterday. And I was right!" That afternoon, the Ethics Committee had cleared him of any charges of "personal" complicity in the alteration of financial records submitted for its continuing investigation. It also postponed any further hearings until after the election, and Brooke was free at last campaign full time for a third-term in the Senate.

The next night, he went out to Springfield, and on a statewide television hookup gave his able young challenger, Rep. Paul E. Tsongas (1)-Mass.), a lesson in the tactics of political debate.

For 60 minutes, Brooke displayed those skills that Kennedy admires, on issues ranging from atomic strategy to inflation and absenteeism. When Tsongas was asked "as a liberal," if he felt "at all uncomfortable about the prospect of defeating the only black United States senator," he said, "I would hope that in this state we have evolved to a point where we can judge people totally on the issues . . ."

Brooke, asked fro comment, said he agreed, and then wove this lovely pattern: "Obviously, I am the only black that's ever been popularly elected to the United States Senate, which only meant to me that Massachusetts was color-blind.

"And there was some symbolism. I am sure that every little black child looksup and says, 'If Ed Brooke can make it, I can make it' And I think every little child looks up and say, 'By God, if Ed Brooke can make it, I'm sure I can make it.'

So it's there whether we like it or not . . . But I want to be judged on my merits and on my record . . and I think it's a record that has been in the best interest of the people of this state and this nation and, if I might immodestly say, of the world"

That kind of artistry by the two-term attorney general and two-term senator is a bit much for a two-term congressman making his first state-wide campaign, even one as skillful as Tsongas.

The 37-year-old Peace Corps veteran has an unblemished liberal voting record and a reputation as a hard-working, modest and accessible promoter of urban revitalization and alternative energy projects. He filed for the Senate before any of Brooke's personal problems became public so his motives are clear of a suspicion of opportunism.

He won a spirited Democratic Primary with clever television ads, playing off the difficulty voters had pronouncing his name. (It is SONG-us, with a silent "T," not Tiss-cuss, as the little boy in the ads kept insisting.)

Tsongas and Brooke have some legitimate issues differences, particularly in defense policy, where Brooke takes a harder line toward the Soviets and criticizes Tsongas for voting against all defense appropriations, rather than just the weapons system he thinks are wasteful.

But neither these differences between two men who have parallel, liberal views on most domestic issues, nor the growing sense of Brooke's remoteness from the state in his second term, would have put his career in jeopardy - were it not for the flood of personal problems stemming from Brooke's divorce suit.

"It's been just one body blow after another," says Leon Charkoudian, Brooke's campaign manager. "The divorce itself. The charge of perjury in the financial statement. The supposed Medicaid fraud. Now the supposed altering of the records.

"Every one of them has been reported and repeated for days, and then when he is cleared - as he has been - it's a one-day story. You just never catch up."

A published poll last week showed Brooke running 7 points behind Tsongas, and some private polls show a slightly wider margin. But Brooke's owm surveys - and one taken last week for a state Democratic candidate - put the race dead even.

Given Brooke's campaign skills, his seniority and incumbency, and what he likes to call "the investment" Massachusetts' voters have in his inique career, he might be able to pull out another win, even if he is running slightly behind today.

But this time, Brooke's is up against several factors he has not faced before. Even though neither conservative challenger Avi Nelson nor Tsongas made any overt effort to exploit Brooke's personal problems, the senator has been damaged by the months of publicity and investigation.

"It's there in the polling," said one adviser. "Remember, his buttons used to say 'Proudly for Brooke.'"

Fund-raising was crippled for months for uncertainty whether Brooke would forced to withdraw from the race, and some of his traditional liberal money sources have dried up.

Tsongas is able, elusive rival who has come through the primary and general election campaigns unscarred. Small deceptively soft-spoken, with a boyish sincerity that projects well on television and a nice, self-mocking sense of humor that contrasts with Brooke's tendency to senatorial pomposity, Tsongas also has some less-visible asset.

He has put together a formidable fund-raising machine that put him on television before any of his rivals in the primary and will outstrip Brooke in these closing days of the campaign.

And he has built a first-rate statewide volunteer organization - mainly of young people - which has hand-delivered over 1 million pieces of literature in the past three weekends.

And then there is the Kennedy factor.

When Ted Kennedy came to the Senate in 1962, he inherited the warm, cozy relationship his brother, John, had enjoyed, with Republican Sen. Leverett Saltonstall. When Brooke succeeded Saltonstall in 1966, the bi-partisan cooperation continued, although without quite the same element of personal friendship.

It was helpful to both men to share and diffuse the anger of their constituents when they took identical and unpopular positions on busing and abortion, for example. Brooke gave only the minimum formal support to Kennedy's challengers, and Kennedy did as little for Brooke's opponents in 1966 and 1972.

When Kennedy was in trouble after Chappaquiddick, Brooke publicly welcomed him back to the Senate club. And when Brooke was being besieged last spring on financial charges steming from the divorce, Kennedy made a point - when hosting Massachusetts editors at his McLean, Va., home - of inviting Brooke to be with him.

But this fall Kennedy is making a major effort to elect Tsongas and beat Brooke. He has helped raise funds for the Democratic challenger, and has made a television spot saying, pointedly, that Tsongas "has accomplished more in four years in the House than some senators do in a lifetime."

That TV spot has been played heavily the last 10 days and is created by Tsongas' managers with a significant jump in Tsongas' standing in several parts of the state where he is still relatively unknown and had been trailing Brooke.

Next week, Kennedy and Tsongas are to campaign together for two days in both Tsongas' home territory of Lowell, where he hopes to build a massive margin, and in southeastern Massachusetts, where he is relatively weak.

The intensity of Kennedy's involvement has surprised - and shaken - some of Brooke strategists. It has also angered some leaders of Boston's black community, who support both the incumbent senators. "If Ed Brooke is beaten with Kennedy's help," said a black minister at the Brooke birthday party, "an awful lot of us are going to find it difficult to

Officially, Kennedy is working have for Tsongas because he says he admires him and says he thinks he would be a good senator. Unofficially, speculation goes, Kennedy is looking beyond Massachusetts to his chairmanship of the Judiciary Committee and a possible presidential compaign. He would welcome a Senate colleague who would devote himself to "taking care" of Massachusetts' problems, as Tsongas has promised to do and as Brooke has sometimes neglected.

A Tsongas victory would be a nationally noted demonstration of Kennedy clout. Where Brooke and Tsongas differ, it is on Kennedy's issues. Tsongas supports the Kennedy health plan, while Brooke wants a larger role for private insurance companies. Tsongas, like Kennedy, urged President Carter to veto the tax bill as a ripoff of low-income families, while Brooke said Carter should sign it.

Brooke told student editors the other day that electing Tsongas wuld mean just "another Democrat" in the Senate.

Others say the election has come down to a choice of having a second Kennedy (or a Kennedy second) in the Senate, rather than having one Kennedy and one Ed Brooke.