Rep. Stan Parris abandoned his expensive, struggling Republican campaign for Virginia governor yesterday, clearing the way for Republican Wyatt B. Durrette and Democratic state Attorney General Gerald L. Baliles to oppose each other once again, this time for the state's top office.

"In the words of singer Kenny Rogers, 'you have to know when to hold 'em and know when to fold 'em,' " Parris told reporters at a hastily called news conference in his Capitol Hill office. "Now is the time to fold 'em."

Parris, in a surprise reversal of his repeated vows to take his campaign to the Republican nominating convention May 31, endorsed Durrette, conceding he does not have enough statewide support to beat the Richmond lawyer.

Parris' decision to end his million-dollar campaign sets the stage for a race between Durrette and Baliles, who narrowly beat Durrette in their 1981 race for state attorney general.

Both candidates are considered moderates within their own parties and are expected to mount costly media-centered campaigns this fall to replace Democratic Gov. Charles S. Robb, who cannot succeed himself.

The Northern Virginia congressman's announcement came only five days after Lt. Gov. Richard J. Davis, 63, gave up his own faltering attempt to win the Democratic nomination for governor.

Parris' withdrawal from the race allows both parties to gear up their gubernatorial campaigns almost a month before their nominating conventions.

"This was a difficult but responsible decision by Stan," Durrette said in a statement. "It will give the Republican Party, however, a full month to take advantage of unity at the top of the ticket."

As recently as Friday, Parris, 55, said he would not give up his campaign, despite warnings from several key supporters and staff aides that he could not win and requests from state Republican Party leaders that he pull out of the race.

"The potential for some real party divisiveness was very high," said John T. (Til) Hazel, a Fairfax developer and a major Parris contributor. "He might have squeaked something out . . . but when you get in that position there are a lot of downside risks."

Parris said yesterday that his unsuccessful attempt Saturday to win all 111 votes from Prince William County, part of his congressional district, was instrumental in his decision.

Parris said his telephone polling of uncommitted delegates also showed his candidacy was weak elsewhere.

"The question has always been, can I run far enough and fast enough to catch up and win," said Parris, noting that only a few delegate selection meetings are scheduled before the Norfolk nominating convention.

"I have reluctantly concluded that the answer is no, we have not come far enough, fast enough," he said.

Television evangelist Jerry Falwell's recent endorsement of Durrette also was eroding much of Parris' support in the coming Tidewater area delegate selection meetings, Parris said.

Parris' campaign began in November, just after he won his fourth term in the House of Representatives. It was fueled by massive campaign contributions from Northern Virginia developers.

But in recent weeks the Parris campaign has fizzled as Durrette, 47, a former Fairfax County state delegate, repeatedly outdistanced the congressman at delegate selection meetings across the state. The turning point came in early April when Parris failed to win the entire block of votes in Fairfax County, which includes part of his district.

Hazel, a close friend of Parris', said "the turning point in my mind came even before that" with Parris' poor showing in earlier mass meetings and his failure to win key endorsements from party officials.

Although Parris said he made his final decision to pull out of the race at his Capitol Hill office Tuesday afternoon, he spent several hours at Hazel's Fauquier County farm Sunday morning, trout fishing and discussing the campaign.

Hazel, who the Parris staff said has contributed at least $100,000 in financial backing and services to the campaign, said he had been discussing with Parris the possibility of withdrawing for the past month.

"I was afraid of blind will prevailing while you march off the cliffs," said Hazel. He said he and Parris drank two pots of coffee during their Sunday discussions. "Stan hates to quit," he added.

Durrette campaign officials said Hazel told them Monday to expect an announcement this week on the race.

"I believe that I have done well," Parris told reporters. "I don't regret a day of it." He said he will now turn his attention to his next reelection bid for Congress: "I'm looking to '86 starting half an hour from now.