About 2:45 yesterday afternoon, Raul Ramirez of Mexico had a stunning thought, "God, I can beat Borg," he said to himself. Two hours later, dead wrong, Ramirez told newspapermen, "He's like a machine."

Bjorn Borg of Sweden beat Ramirez, 6-7, 6-4, 6-4, 6-0, in yesterday's quarterfinal round of the United States Open tennis tournament at the National Tennis Center.

For Borg, the winner of the French and Wimbledon championships this year, the victory was another step in his pursuit of the tennis Grand Slam. He needs the championship here and in Australia to join Rod Laver and Don Budge in the exclusive Slammers club.

Yesterday's second set showed how mighty Borg is, in this the finest season of his brie fand astonishing career. For 10 minutes, he so dominated Ramirez that the Mexican, one of the very best players in the world, realized his relative inadequacy.

From believing he could beat Borg, Ramirez quickly moved to mental, if not yet official, defeat. Each man had won a set, and from four-love down in the third set Ramirez came back to a 4-3 deficit.

Borg held service needing only four points, the last an ace down the center, past Ramirez' frozen forehand.

That made it 5-3, and while Ramirez earned a stalling victory in the next game, Borg went up, two sets to one, by winning the 10th game on good fortune and consummate skill.

A Borg backhand volley collieded with the net tape, then bounced a second time on the cord and fell over to Ramirez' side, falling so softly the ball barely bounced on the concrete-like surface.

That put Borg up 15-love. He stayed in front at 30-15 with a topsin lob that caought Ramirez in front court, helpless.He could only stand and watch the shot fall good.

Borg's insistent pressure then forced Ramirez into two set-ending errors, the second a backhand ground-stroke that hit the net cord and fell not on Borg's side, but on the Mexican's.

With Borg leading, 2-1, in the best-of-five-sets match, Ramirez knew his chances of winning the last two sets against the Swedish machine were nil. "Mentally, that (losing the third set) really hurt, Ramirez said.

The fourth set was a formality. Now Borg will go into the semifinal round tomorrow against Vitas Gerulaitis, the New Yorker who, to prepare for this tournament, spent $15,000 duplicating in his backyard the fast courts in use here.

Even though, he handled Ramirez easily when it counted most, Borg was not the sensational shotmaker the tennis world admires. He has played spottily in this tournament. A soft-court player as a junior, he doesn't like the hard courts here.

"They might be a little bit too fast," Borg said after winning yesterday. "But I'm getting used to it."

That is unsettling news for Gerulaitis.

He'd prefer Borg the way he played in yesterday's first set. In that one, Borg won the first three games, controlling Ramirez with powerful serves and precisely placed ground strokes short to the Mexican's backhand.

Suddenly, though, Ramirez was even at 3-3 and in the 10th game he survived a double-set point on his serve. Each held serve through 6-6 and in the breaker. Ramirez went up 4-2 when he put away a volley on one of Borg's short-to-the-backhand returns.

Borg never led in the tie breaker, Ramirez winning the set with a service winner to Borg's forehand.

But in the second set, the pattern of the match was made clear. Borg dominated on his serve, Ramirez struggled on his. Though Ramirez is crafty, he seemed ill-advised in serving always to Borg's backhand, permitting the Swede to get it back short to Ramirez's backhand.

Ramirez had an explanation of sorts.

"I can hit it short, long, anywhere, and I can't beat him," he said.