The Atlantic Coast Conference has gotten the glamorous matchup it had been hoping for. North Carolina, the No. 1 team in the nation, and Virginia, ranked No. 3, will meet Sunday at 1 p.m. to decide the ACC tournament championship after winning semifinal games today in Greensboro Coliseum.

Wake Forest nearly ruined those plans, taking Virginia into overtime before guard Ricky Stokes, at 5 feet 10 the smallest man on the court, banked in a 12-foot shot at the buzzer to give his team a 51-49 victory. Virginia played without all-ACC guard Othell Wilson, who bruised his right thigh Friday night and is questionable for Sunday's game.

North Carolina also received a scare, though not as severe, before it defeated North Carolina State, 58-46, in the first game of the doubleheader attended by 16,034.

Sunday, a national television audience will witness the third game this season between the regular-season cochampions. This game probably will determine the top seeding in the NCAA tournament and which team stays in its home East Regional. North Carolina (26-2) won, 65-60, at Chapel Hill in January; Virginia (29-2) won, 74-58, at Charlottesville last month.

All four ACC semifinalists almost assuredly will be in the NCAA tournament, three getting at-large bids Sunday afternoon and the tournament champion getting the automatic berth.

"This will be the game of the century--round 3," said Virginia Coach Terry Holland.

But round 3 almost was kayoed by Wake Forest (20-8). There were 35 seconds left in the five-minute overtime when Stokes took an inbounds pass from back court mate Jeff Jones. Stokes dribbled alone out near the scorers' table until only 10 seconds remained.

Then Stokes passed to Jones, who gave the ball right back. Stokes tried to pass inside to 6-8 forward Craig Robinson, but Wake's Guy Morgan deflected the ball. Stokes picked it up with two seconds left and took the shot that banked in for the victory.

"I tried to get it to Robinson, but it was a bad pass," Stokes said. "It got deflected back to me and I just shot it."

In the preceeding timeout, the Cavaliers planned to look for freshman Tim Mullen (10 points) inside, Jones (10 points) outside, or 7-4 center Ralph Sampson on the base line for the final shot. Stokes, who to then had made only one shot, was about the last option.

Virginia, six of whose last seven games have been decided in the final seconds, already had failed to win in regulation when Jones missed an 18-footer at the buzzer.

"Sometimes, it's the bounce of the ball that decides the game," said Wake Forest Coach Carl Tacy. "We just couldn't seem to get a break."

"I guess it falls to us to provide the excitement for the tournament and this afternoon's game was just that," Holland said, referring to the fact that four of the six tournament games were slow-paced, dull affairs. So were the last 12 minutes of this one.

But it would be difficult to produce more action than Virginia and Wake did through one stretch of the first half, when the lead changed on 10 consecutive possessions.

Virginia went ahead, 29-24, with 1:03 left in the half on a three-point play by Dan Merrifield, a tubby and seldom-used forward. The Cavaliers led by five points most of the second half.

Wake closed to 45-43 with 10:38 left, on two free throws by 6-11 center Jim Johnstone (13 points), following a bad pass by Jones. Johnstone tied the score at 45 with a hook shot that was goaltended by Sampson.

The teams traded baskets, then called timeout three times before Wake got the ball with 4:51 left, following a Virginia miss, and played for the final shot.

Virginia ruined that strategy by purposely fouling Scott Davis, a 57 percent foul shooter. Davis, the brother of former Maryland star Brad Davis, missed the first of his one-and-one free throws. Virginia called time with 17 seconds left, but Jones missed the final shot.

So, Sunday, it's Sampson, last year's college player of the year, against North Carolina's two strong inside players, center Sam Perkins and forward James Worthy.

The Tar Heels trailed, 32-31, with 17:05 remaining today. But Perkins (16 points) made two free throws that started them on a 8-2 spurt. Carolina made 20 of 24 foul shots, State all six it took.

The critical point came with six minutes remaining when State (22-9) had the ball and a chance to pull within five points. But Lorenzo Charles' pass was intercepted by Jimmy Black. He passed the ball to Michael Jordan, who dunked it and made a subsequent foul shot. State fell behind, 50-40.

The Wolfpack pulled to 50-46 when Worthy (15 points) and Black missed consecutive one-and-ones in the last two minutes. But the Tar Heels closed the game by making eight straight free throws.