For the last four years, Virginia's J. Marshall Coleman didn't want to be seen anywhere near the White House. Too many Democrats. Too many bureaucrats. Too many liberals writing too many regulations.

But a hoard of Secret Service agents couldn't have kept Coleman, the Republican nominee for governor, away yesterday. "This is the one time since I've been in Virginia politics that coming to Washington has been an asset," he quipped as he and his GOP running mates emerged from a 30-minute meeting with President Reagan in the Oval Office.

For Coleman, lieutenant governor nominee Nathan H. Miller, and attorney general nominee Wyatt B. Durrette, yesterday's White House meeting was the first of what they believe can guarantee them victory in the fall.

Coleman said yesterday he is confident Reagan will campaign in Virginia. "We didn't discuss the details of that with the president, but I think we will see the president taking a role in the campaign," Coleman said. "He was very positive, very supportive."

That support from Reagan could prove crucial to Coleman, who has been struggling to bring the party's conservative wing behind his ticket ever since a divisive party convention earlier this month. Reagan carried Virginia last fall with the second largest presidential margin in the state's history.

Many Virginia conservatives, however, have expressed doubts about Coleman's conservatism, and were angered when Miller was nominated over their candidate, State Sen. Herbert H. Bateman.

While the three candidates were in the Oval Office, their staff and top state Republican operatives were next door at the Executive Office Building discussing strategy with White House political aides Lee Atwater and Ed Rollins.

The three candidates, who later joined that session, declined to discuss specific details of that meeting, but said they were assured of the help of administration officials from cabinet level on down. "They basically said that we should just get organized and tell them what we need," said Miller.

Virginia and New Jersey are the only states holding statewide elections this fall, and Virginia Republicans are stressing that their race between Coleman and Democratic Lt. Gov. Charles S. Robb of McLean will be a referendum on the Reagan administration's performance. The administration already has dispatched Vice President Bush, Budget Director David Stockman and Treasury Secretary Donald Regan to stump at Coleman fund-raisers.

That strategy drew criticism yesterday from Robb spokesman George Stoddart, who accused the Republican of trying to shift the focus of the campaign away from Virginia. "We believe this is a referendum on the future of Virginia, and that Virginians are going to make a decision based on who they trust and who they think can lead the commonwealth," Stoddart said.

"They're making this a referendum on the popularity of a man we don't really have any problems with as far as budget-cutting is concerned."

But the three Republicans had a few jibes of their own for Robb, a fiscal conservative who campaigned last year for Jimmy Carter and whose wife, Lynda, is the daughter of former president Lyndon B. Johnson. "He's got his White House and we've got ours, and frankly we'd rather have ours," joked Durrette.

Asked about Reagan's plan to cut back on federal impact aid to local school districts, Coleman said only that he supports the president's efforts to cut government spending and end tax programs that have "harmed the economy."

Virginia, particularly the Washington suburbs, is among the states that stand to lose the most money from Reagan's plan to cut the aid to school districts that have tax-exempt federal installations within their boundaries.