An obscure state legislator and former racetrack "hotwalker" has emerged as a strong long shot candidate in the Republican search for a challenger to incumbent Gov. Edmund G. (Jerry) Brown Jr.

The long shot is Ken Maddy, whose identity was known to only 5 percent of California's voters last October. Now Maddy has become an acknowledged colse contender in a five-way GOP race behind the better-known attorney general, Evelle J. Younger and former Los Angeles police chief Edward M. Davis. Maddy, who has an appeal to Democrats and younger voters that the other GOP candidates lack, is the one opponent who worries the Brown camp.

Whether or not he wins, Maddy, 43, a Republican state assemblyman who represents a heavily Democratic district in Fresno, is definitely the surprise of the race. While he is regarded as an able and popular legislator by his colleagues. Maddy appeared at the outset of the race to have little chance of competing with either Younger or Davis.

In fact, the only place that Maddy was known at all outside of his home district was on the backstretch of such racetracks as Hollywood Park and Del Mar, where, as a yound adult, he had worked as a hotwalker - the person who walks the horses around to cool them out after a race - and then as a groom.

Maddy liked the racing life, and at one time bought a cheap horse and raced him at Caliente, across the border from San Diego in Mexico. But he gave it up when he married and his wife decided that the track was no place to raise a family. So Maddy went to law school and became an attorney.

Maddy's emergence as an effective candidate is a tribute to his personable intelligence on a wide range of issues, and most of all to the power of television in a state where the area is so vast and the population so large that the TV tube is the only effective means of political communication.

His success also is a comment on the stumbling, uncertain campaign of his adversaries, who have failed to excite noticeable interest in an electorate seemingly preoccupied with a single isue - the Jarvis-Gann initiative, which would drastically reduce property taxes. According to the conventional wisdom that conservatives fare best in Republican primaries here, Maddy would seem an unlikely prospect. Despite a belated effort to establish a conservative record in the legislature, Maddy is clearly to the left of most of his GOP colleagues on civil liberties issues. He has, for instance, supported measures that reduced penalties for marijuana use and that removed criminal penalties for homosexual relations between consenting adults.

Maddy has tried to offset the effect of these votes, which have been well-publicized by his opponents, by pointing out that he was the only one of the GOP gubernatorial candidates to support former California governor Ronald Reagan in his 1976 bid to unseat former president Ford.

The television blitz that propelled Maddy into the limelight on the sole theme of "he will beat Jerry Brown" is the brainchild of John Deardourff, Ford's media expert in the 1976 election campaign against President Carter. Deardourff reasoned correctly that Maddy could attract interest by getting on television in February before the other candidates were competing for voter attention.

The money to do all this - Maddy is spending between $1.3 million and $1.5 million on his campaign, including an estimated $850,000 on television - came largely from big farmers in the San Joaquin Valley, whose economic interests Maddy has loyally supported.

The farmers, long on the decline as a political force in California, were encouraged to exercise their political muscle by their 1974 success in defeating a Cesar Chavez-backed initiative strengthening farmworker union power.

Maddy has gambled that California Republicans are tired of losing elections and will opt for a fresh, new face instead of a tried-and-true loser. This perception is regarded as both unfair and inaccurate by supporters of Younger, who as candidate for judge and district attorney in Los Angeles and then twice as attorney general has never lost an election.

But Younger's once-commanding lead has declined steadily in the polls. For months he seemed to be waiting out the election campaign, relying on his name and office to carry him through the primary.

This may have been Young's best strategy.When he tried to gain publicity recently by releasing a report on 92 purported organized crime figures, he abruptly found himself under attack from all sides.

Almost every name on the report and all of the information in it was well-known. The exceptions were at least two people who were not gangsters at all, one of them a Downey design engineer whose name was the same as a mobster's. When Younger drove out to apologize to the engineer, he found television cameras there ahead of him, and fled in his car.

For good measure, the list of alleged criminals contained one prominent contributor to Younger campaigns.

While Younger has been frittering away his lead, Davis has failed to capture the imagination of GOP voters outside of the right wing. Davis may well wind up the nominee. But many Republican politicians shudder to think what this would mean in the general election.

Every poll shows Davis as the weakest candidate against Brown. The former police chief recently cast great doubt on his ability to move to the middle and become a credible candidate when he answered a questionaire of the United Republicans of California, an organization so conservative it has repudiated Reagan, by taking a host of far-right positions.

Davis said he favored the "liberty amendment" to abolish the federal income tax, supported withdrawal of the United States from the United Nations, opposed the Equal Rights Amendment, opposed detente with communist countries, wanted to revive federal and state committees to investigate "un-American activities" and opposed the genocide treaty pending before Congress.

The problem for Davis' opponents, however, is that the moderate vote is split among Maddy, Younger and San Diego Mayor Pete Wilson, who on his record is highly qualified but has failed to excite voter attention. State Sen. John Briggs, who hoped to aid his cause by crusading against homosexuals, is a distant fifth in all the polls.

With slightly more than three weeks remaining before the June 6 primary, Maddy is being urged to sharpen the differences between himself and Davis by calling attention to the former police chief's more extreme positions.

But along with his moderation, Maddy appears to lack an instinct for the jugular. He says he doesn't want to make statements that he will regret after the election and that he can win or lose with equanimity, knowing he has done his best.

The one sure bet is that if Maddy does lose, this affable long shot candidate will be back at the track when the Fresno fair comes to town this October, visiting with his friends on the backstretch and placing a few well-chosen bets on horses even less well-known than Ken Maddy was just a few months ago.