During eight years in Congress and a lifetime in Maryland, Michael D. Barnes has been a stranger in Baltimore, where political tradition is built on Pabst and political patronage, and names like Bonvegna, McGuirk and Miedusiewski.

But now the polished Montgomery County attorney is building a new relationship with the port city, thanks in large part to his acquaintance with Michael Cryor. In five months Cryor, a black businessman and former congressional aide, has helped introduce Barnes to a once-invisible group in city politics that he thinks can help Barnes' uphill battle in the campaign that pits four whites against each other for the Democratic nomination for U.S. Senate.

The high risk strategy set out by Cryor and Barnes is to break into vote-rich Baltimore by boring in through the city's large black community, an emerging political force that has long felt alienated from the white political establishment that has ruled city politics for decades.

Barnes strategists think he can capitalize on what they believe is a lingering hostility between the black and white ethnic communities. As an outsider, they say, Barnes may be more attractive to black voters than the Democratic front-runner, Rep. Barbara A. Mikulski, a Polish Catholic, East Baltimore native.

"The tension [between the black and white communities] is definitely still there, and it's growing," said Democratic Del. Wendell H. Phillips, a black minister who is running for the 7th District congressional seat being vacated by Rep. Parren J. Mitchell and who is neutral in the Senate race. "Historically black folks vote for white folks, but white folks don't return the favor."

With the city vote crucial to winning the Sept. 9 primary, Barnes is spending about 60 percent of his time in the city. He says he has not written off the white ethnic voters -- although he is hardly a household word in their communities -- and is courting groups as diverse as business professionals and gays. But most of his energy is spent appealing to blacks, who comprise about 55 percent of the city population.

Barnes has hired five blacks for his 12-person campaign staff and named Cryor -- who worked for influential black congressman Mitchell -- as his statewide campaign manager. Barnes also has opened his campaign's Baltimore account in a black-owned bank, and decided to buy all his bumper stickers, posters and other campaign paraphernalia from businesses operated by blacks.

He has wooed black community figures such as Larry Little, a top official in the Rev. Jesse Jackson's Maryland campaign, and Sam Redd, owner of a well-known funeral home in the city. To pave the way in Baltimore, he also courted Jackson's Rainbow Coalition in Prince George's County, despite its rivalry with the Democratic establishment there.

In recent weeks, Barnes has hammered away at Mikulski's votes for amendments allowing segregated schools to keep their tax-exempt status, votes she said were cast to protect Catholic schools. He has stressed his liberal voting record, which he says is similar to Mitchell's. And he has highlighted his efforts to block Reagan administration aid packages to the rebels fighting the government of Nicaragua, a war that Cryor says is unpopular among blacks.

"With respect to the black community, he's working it very hard," said Kurt L. Schmoke, a popular black lawyer who won election as state's attorney for Baltimore by a landslide in 1982 and is considered a likely Democratic mayoral contender in 1987. "Whether that will bear fruit is subject to speculation."

"There seems to be a great liking for Mr. Barnes," among the black ministers, said the Rev. Walter S. Thomas, president of the Baptist Ministers Conference of Baltimore, whose endorsement in the Senate race is expected soon and is considered key to winning black votes.

A few months ago, none of the ministers knew Barnes, but now "Barnes seems to be leading," said Thomas. "I don't understand it. It might be his doggedness. He doesn't seem to give up, and he's talking about the things that ministers like to talk about -- like jobs, infrastructure and putting blacks in decision-making positions."

For Barnes, who according to polls is trailing far behind Mikulski and is roughly even with Gov. Harry Hughes for second place, making inroads in Baltimore is the most crucial aspect of his campaign. In the 1982 Democratic primary, the city and Baltimore County provided 46 percent of vote, compared to 22 percent from Montgomery and Prince George's counties.

Barnes says he needs 20 percent of the vote in the Baltimore area to win in a statewide race. Despite his new strategy, some Democrats predict he will get far less. Del. Paul Weisengoff, an old line, white Democrat from south Baltimore, said, "I believe she [Mikulski] will get 70 percent of the vote out of my district," in a four-way race. "She's that far ahead."

That glowing view of Mikulski is hardly universal, even among leaders of the city's white political establishment. But few of Mikulski's critics are expected to jump ship for Barnes, whose somewhat intellectual, high-brow style -- he recently said he has been effective in Congress without having to "trade votes" -- clashes with that of the old Baltimore pols. Politics, as explained by City Council member Dominic (Mimi) DiPietro, is a different game in Baltimore.

DiPietro, a colorful and popular politician, said that when Mikulski was elected to the House 10 years ago, "she didn't do nothing for my people . . . . She had 31 jobs, and we asked for two." One candidate, a lawyer, was rejected as unqualified.

"If I was Barbara, and I went to Congress, he'd have been qualified," said DiPietro. "We had a hell of an argument in her office."

But DiPietro is throwing his support to Hughes, not Barnes.

In Baltimore County, a fourth major candidate, County Executive Donald Hutchinson, is expected to be Mikulski's toughest competition.

While Barnes has been spotted pressing the flesh along Eastern Avenue in east Baltimore, a solid working-class neighborhood, he turned to the black community when he was looking for a campaign manager last fall. One of the first people he consulted was Mitchell, whose family has built a political dynasty on the city's black west side.

Mitchell recommended Cryor, who had worked on his congressional staff. Cryor's name was also mentioned by Schmoke's aides and by professors at Morgan State University.

Cryor had been an associate dean at Morgan State and was popular during his days as a baseball player at Baltimore City College. Moreover, his father, a minister in downtown Baltimore, also operated a barbershop that for 25 years was a neighborhood gathering place.

Barnes offered Cryor, 40, the job of running the Senate campaign even though he had never run a campaign before.

"The best thing he did was hire Cryor. It was a slick move on Barnes' part," said Phillips.

The dividends of hiring Cryor quickly began to pay off. In early March, after a bruising battle with Mikulski, Barnes won the Rainbow Coalition's endorsement. A short time later Rainbow Coalition member Carl Snowden, a City Council member in Annapolis and civil rights activist, independently endorsed Barnes.

Then, with polls still showing him far behind and his staff's morale beginning to wane, Barnes was pushed to tackle Baltimore more aggressively.

"I told him quite frankly that we're moving into Barbara's territory, and he's got to be more focused," said Cryor.

Barnes switched styles and began attacking Mikulski so hard on her votes on tax-exempt status for segregated schools that she accused him of "trash-bashing." But the tactics paid off. Mikulski's tax votes were cited by Edwin Johnson, a former Baltimore City Council member, and other members of the black East End Democratic Forum when the club endorsed Barnes.

Even a rival black club that was expected to back Mikulski, the East Side Democratic Organization headed by City Council President Clarence H. (Du) Burns, has been fertile ground for Barnes. "A person I did not expect to get much support, Mike Barnes, came out with considerable support," said Burns. "I guess out of courtesy and friendship to [Cryor] they decided to back Barnes" and divided the vote to such an extent that Mikulski failed to get the majority needed for the club's endorsement. Another vote is to be taken next month.

Mikulski says she is not worried about Barnes' strategy because she says it ignores her "long ties to that constituency, going back to my days working in the civil rights movement."

"Ordinary citizens in the black community feel that they not only know of me, they know me," Mikulski said.

"Support for Barbara is going to come from people who came through the turmoil and remember Barbara was on our side," said Burns. "But younger people don't remember. To the younger people it doesn't mean a hill of beans . . . . We're going through a transition period. Things change."