Democratic gubernatorial nominee Charles S. Robb, faced with certain rejection by the Virginia AFL-CIO, said tonight he would withdraw his name from consideration for the labor organization's endorsement.

Robb, whose conservative views on labor issues have deeply angered many union members, will become the first Democrat running for major statewide office in a decade to be denied the labor endorsement. He said he will formerly pull out Saturday morning, after addressing the AFL-CIO's convention here.

"It was pretty obvious they [his opponents] have the votes," said a clearly tired and disappointed Robb, who withdrew after meeting with key union leaders and his two running mates, Richard J. Davis and Gerald Baliles.

"It would have been very close but there is no question . . . it seemed wrong to go on with a potentially divisive debate . . . knowing the numbers are not there," Robb said.

Robb's action means that Davis, the party's nominee for lieutenant governor, and Baliles, the attorney general nominee, also will be denied formal AFL-CIO backing.

Earlier in the day, greeted by a chorus of boos from union delegates wearing bright red "No!" buttons, Robb had made a last-minute plea for support from the convention.

The labor leaders have been angered by Robb's enthusiastic support of the state's Right to Work laws and by his promise to veto any legislation allowing collective bargaining by public employes. They also do not like his support of President Reagan's budget-cut and tax-cut programs and his opposition to extending the Voting Rights Act.

Robb, Virginia's lieutenant governor, told the convention he realizes he has "honest differences on a couple of important labor issues. He told the delegates, "I know [the endorsement] is not an easy question, and I know I haven't made it any easier."

But he appealed for support, saying "I hope you'll find a way to stick with us . . . because I can assure you we are going to stick with you."

While Robb's plea quieted the catcallers, it did not change the minds of many union dissidents who oppose him, including leaders of the state's steelworker, machinists, public employe and food worker union. They were confident that they had more than enough support among the 900 or so delegates here to deny Robb the endorsement, which requires a two-thirds vote.

Thomas McNutt, of the United Food and Commercial Workers, said, "We're tired of helping Democrats who act like Republicans."

Despite his conciliatory tone today, Robb offered no changes on any of the issues that have aroused opposition to his endorsement. Instead, he pledged an open administration.

"I want you to know you're going to have friends in Richmond," he told the delegates.

"He didn't offer us anything, not even crumbs," said Daniel LeBlanc, of the state machinists council.

Robb's Republican opponent, Attorney General J. Marshall Coleman, did not appear today, although he was invited to the convention. His campaign aides say he has written off any hope of official labor support.

Robb has won the backing of several major unions, including the United Mine Workers and United Auto Workers. But without AFL-CIO support, he could lose tens of thousands of dollars in union campaign contributions that normally have gone to Democrats.