Codex has erased all questions about the identity of the best 3-year-old in America. He won the Preakness today in a fashion that indicated he may be one of the best horses in years.

The California invader scored by 4 3/4 lenghts over Kentucky Derby winner Genuine Risk, then survived a foul claim by the filly's jockey. He covered the mile and three-sixteenths in 1:54 1/5, the third-fastest time in the 105-year history of the Pimlico classic.

The outcome was not only a triumph for the colt, but for his trainer, D. Wayne Lukas, who had seemed to break all the established canons of preparing for a Triple Crown event. Lukas' masterful work will atone for his failure to nominate Codex to the Kentucky Derby.

Codex had not raced in 34 days, an almost unheard-of layoff before a Triple Crown race, and it was this absence from competition that made handicappers in the crowd of 83,455 somewhat skeptical of his chances. The made the filly Genuine Risk their favorite, for sentimental and rational reasons, with Colonel Moran the second choice and Codex third choice at 2.7 to 1. These three horses would dominate the race.

A 60-to-1 shot, Knight Landing, broke sharply from the inside post and sprinted to the early lead, with Colonel Moran stalking him, as expected. But jockey Angel Cordero Jr. was able to settle easily into third place with Codex as the field raced past the stands for the first time. Meanwhile, Genuine Risk had dropped to the rail and sat in the middle of the pack, within easy striking distance.

On the backstretch Colonel Moran tried unsuccessfully to get past Knight Landing, but Cordero said, "My horse was asking me to go." Codex went, and quickly shot into a lead of more than two lengths. Jockey Jacinto Vasquez, on Genuine Risk, saw this move and knew it was time for her to go, too.

Genuine Risk accelerated powerfully, just as she had accelerated at Churchill Downs two weeks ago. She drew within a half length on the turn, when Cordero instigated an incident that will be debated at length in the coming days.

Cordero glanced at the filly outside him and permitted Codex to drift wide on the turn, past the middle of the track, carrying the filly even wider. They didn't seem to make any hard contact, but they were close enough that Vasquez was unable to whip freely for a couple of strides.

For a moment if appeared that Genuine Risk was going to blow past the leader. But Codex gathered speed and started to draw away from the filly with every strong stride. He ran the last three-16ths of a mile in a sensational 18 1/5 secons, and the only remaining question about the Preakness was the outcome of the inevitable foul claim.

"I think they should take his number down," Vasquez argued. "I thought this was a race track, not a rodeo. It is no different from any other race, no matter what the purses. They took the heart out of my filly when he brushed me. He sure brushed me hard."

Cordero said the colt was startled a bit by the crowd and the sight of the starting gate as he went around the turn, but said, "We never made contact and I never hit the horse."

The stewards agreed. "The stewards did not see the winner hit Genuine Risk," said State Steward J. Fred Colwill. "Cordero went slightly wide but in our opinion it did not hinder the filly enough to warrant disqualification."

When the result was made official, Codex paid $7.40, $3.60 and $2.80. Genuine Risk paid $3.60 and $2.80 and Colonel Moran returned $3.40 to show. The exacta was worth $19.60.

Jacklin Klugman, possibly hampered by a foot bruised in prerace training, finished a distant fourth.Behind him were Bing, Samoyed, Knight Landing and Lucky Pluck.

Unlike Genuine Risk, who had displayed precocity from the first time she ever set foot on a race track, Codex was a slow learner. Lukas spotted no hint of greatness in the 2-year-old the Tartan Stable had sent to him, and indeed Codex won only two minor races last year. There was hardly any reason for the trainer to bother nominating him to the Derby.

But in mid-March Codex came to life, and Lukas said he had found the colt's hold card: he liked his races well-spaced, and his training light. With such coddling Codex won the Santa Anita Derby and the Hollywood Derby. Since the latter, on April 13, he had had only three five-furlong workouts.

This was clearly a magic formula, because Codex's performance today unequivocally ranks his among the most acclaimed Preakness winners of the past. Only Secretariat (whose 1:53-and-change record was wiped out by a malfunctioning Teletimer) and Cononero II (who went in 1:54 over an extraordinarily fast track) have ever run faster. Last year, over a similar track, the great Spectacular Bid ran a tick slower, 1:54 2/5.

"I suspect Codex might be as good as anybody in the United States right now," said John Nerud, the manager of Tartan Farm who made the decision to come to Pimlico. Even from the disappointed fans of Genuine Risk, he will not get much argument.

Immediately after the race, Nerud said Codex would head to New York for the Belmont, the 1 1/2 mile Triple Crown closer, before going home.