As Congress wrestled last week with President Reagan's request for $100 million in aid for the contras in Nicaragua, Rep. Michael D. Barnes (D-Md.) took center stage with several sharp blasts at the administration's proposal.

The timing of the contra aid vote in the House could not have been better for Barnes, chairman of the House Foreign Affairs subcommittee on Western Hemisphere affairs and a U.S. Senate candidate who is trailing badly in his race against two better-known Maryland politicians. Without spending a penny of his campaign's media budget, Barnes was courted for appearances on "ABC News Nightline," "The MacNeil-Lehrer Newshour," "Good Morning America" and "Meet the Press," and his name was was in front-page stories in major newspapers, including The Washington Post, New York Times and Baltimore Sun.

Now, as he enters the critical stages of his race against the front-runners, Rep. Barbara A. Mikulski of Baltimore and Gov. Harry Hughes, Democratic strategists are wondering if the free publicity during the past two weeks will translate into more votes for Barnes -- particularly outside of his home base of Montgomery County.

In the past five years, Barnes' leadership on Central America in the House has propelled him into the national limelight, and it has played well among his suburban Washington constituents, who reelected him in 1984 with 71 percent of the vote. But this year Barnes has been unable to parlay his national prominence into recognition among voters in the Baltimore area, which traditionally provides more than 40 percent of the Democratic vote and is a key to victory for statewide candidates in the Sept. 9 primary.

A recent Washington Post poll showed Barnes with solid support in the Washington suburbs but revealed that he is a virtual unknown in Baltimore and its suburbs. There is a reason, according to some state political observers: Having devoted most of his four terms in Congress to foreign policy issues, Barnes has been less active in areas that concern voters in Baltimore, such as harbor dredging, Conrail and the location of a new baseball stadium. In contrast, Mikulski, a Baltimore Democrat whose 3rd Congressional District includes some of the city's suburbs, has been a vocal player on most of these issues.

Despite this handicap, Barnes supporters believe that his foreign affairs background, once known to voters, will be an enormous asset. They point to the popularity of retiring Republican Sen. Charles McC. Mathias Jr. and Democratic Sen. Paul S. Sarbanes as an indication that Maryland voters elect politicians who project statesmanlike images and show a firm grasp of foreign affairs and national issues. Barnes, they say, is cut from the same political cloth.

Keith Haller, a Maryland pollster and Barnes adviser, said that Central America gives Barnes a chance to demonstrate his leadership style. "He has the capacity to confront an issue. He is running up against the president," said Haller. He added that even if voters do not list Nicaragua as a top priority, they know of the conflict and they are concerned about it.

But state Sen. Julian L. Lapides, a Baltimore Democrat, disagreed, saying, "I don't see him [Barnes] making major inroads into the Baltimore metropolitan area.

"It's a critical issue and one that [voters] should" care about, said Lapides, who has not endorsed a Senate candidate. "But I don't think many do, and I think that's the tragedy."

Voters want a senator who "will take care of the home front," said state Democratic Sen. Joseph S. Bonvegna, a veteran of Baltimore politics. His view is shared by supporters of Hughes and Baltimore County Executive Donald P. Hutchinson, who is trailing the other three candidates in the Senate race and believes that voters will support him because of his understanding of the nitty-gritty of local government.

Television appearances, however, will at least get Barnes' name out in Baltimore, which is a start, said Harry J. McGuirk, a powerful former state senator from South Baltimore and now a lobbyist for the city. "I don't think it [Nicaragua] is the major discussion at the dinner table," said McGuirk, who said he had not decided which candidate to support. "But he has touched a certain segment of the voters who are still sensitive about Vietnam and our involvement in unannounced wars."

McGuirk added that those voters are a small part of the population, but that "in a close race, even a couple of votes makes a difference, and I think it will be close."

Barnes said he would not be drawn into a discussion of whether his role in the contra fight helps his Senate race. He said he is playing the same role he has played in previous fights over Reagan administration proposals to aid the contras, a group of rebels who are trying to overthrow the ruling Sandinista government.

Barnes, who drew ire from conservative Republicans last week after labeling the Reagan administration's tactics "McCarthyism," said he made the statement because somebody had to stand up to accusations that opponents of contra aid are helping the Soviets. He said he charged that the Reagan proposals could open up a special CIA contingency fund -- another comment that piqued Reagan supporters -- because he feared that the administration planned to dip into the fund for more contra aid.

Some reporters who covered the contra issue last year said that Barnes was equally active then but less aggressive about getting media coverage. Barnes' campaign spokesman, Bill Bronrott, said the difference is merely that he is more experienced as a press aide and knows what reporters need. Another Barnes associate said the congressman's staff sought less media coverage for him last year because his father was dying at the time.

Perhaps ironically, Barnes' opponents have helped him get into the news by attacking his role as a critic of contra aid. The National Conservative Political Action Committee and the Maryland Young Republicans have targeted him, and Rep. Newt Gingrich (R-Ga.) and two other Republican congressmen held a news conference last week to denounce Barnes' statements about the Reagan administration.

For more than 30 minutes on Wednesday, they accused Barnes of helping the "Soviet empire" and cast him as one of the "liberal radical Democrats who think of themselves as intellectuals because they come out of academic background and occasionally read books . . . . "

Gingrich said he was confident that getting this information out would contribute to Barnes' defeat. But some Republicans, such as Dave Narsavage, spokesman for the National Republican Senatorial Committee, were not so sure. Narsavage said the attacks might backfire and make Barnes better known.

Meanwhile, in the aftermath of Gingrich's news conference, Barnes happily endured another round of news stories and another appearance on "MacNeil Lehrer." "Literally at least 30 colleagues came up to me today asking how much I'm paying" Gingrich and the other conservatives for the free publicity, he said, chuckling