An obscure judge from rural southern Illinois has emerged here as a potentially spectacular undercover agent in a massive federal and state "sting" investigation of alleged bribery, ticket-fixing, influence-peddling and other corruption in the Cook County court system, one of the least savory in the nation.

Since 1981, Brockton D. Lockwood, 39, an associate judge in Williamson County, has spent months handling cases in the heavily backlogged Cook County Traffic Court while secretly wired for sound and taping conversations for the FBI.

According to legal sources and Chicago media reports, the sting operation, named Operation Greylord after the wigs worn in British courts, has yielded information to be presented soon to a special grand jury. Dozens of lawmen apparently posed as felons and lawyers in the three-year probe.

Informed sources said the investigation focuses on about a dozen judges, about 20 lawyers, several politicians, court officers, policemen, bailiffs and other habitues of the Cook County Unified Court, which has 300 judges and each year receives 6 million new cases. These include every traffic ticket issued in the county.

The sources said the probe centers in part on alleged case-fixing by politicians in league with corrupt judges. They said the judges either accept fees for freeing criminals or imposing lesser sentences or otherwise act improperly in handing down verdicts.

Lockwood, a graduate of Oberlin College and Vanderbilt University Law School who has been a Williamson County judge for five years, was used as a go-between to introduce FBI agents posing as lawyers to intermediaries, who allegedly handled illegal negotiations for the judges.

Sources said that Lockwood's easygoing, downstate manner ingratiated him with city folks and that he enhanced his image by wearing cowboy boots that also helped hide eavesdropping equipment.

In an interview with the Chicago Sun-Times, Lockwood estimated that "maybe one judge in eight is crooked" in Cook County. He alleged that the judges' intermediaries include prosecutors, bailiffs, clerks and other court officials.

With a huge backlog of cases, the Cook County court system is a unique creation of Chicago-style machine government divided into separate courts for almost every type of case. For example, there is a heat court that deals with landlord-tenant problems, a gun court that hears weapons registration cases and courts for cases involving divorce, narcotics and prostitution.

As a result, the performance of an elected judge can be checked easily by party officials to determine how the judge performs in certain kinds of cases.

Reports of the sting have circulated here for more than a year since the FBI apparently bungled a fake mugging on a busy downtown street in March, 1982. Agents apparently hoped that it might eventually lead to crooked cops.

Two FBI men staged a "robbery" at Water Tower Place, a glitzy, high-rise Michigan Avenue shopping center north of the Loop, as one grabbed the other's attache case and ran.

The "victim" tackled the "mugger" just as city police arrived. But police soon discovered that the "mugger" had FBI identification stuffed into his socks. Police suspected a sting operation directed at them, and rumors began to fly.

"That was the worst break that ever happened to them," an official of a legal review board said today. "The very last thing they could have wanted was for the Chicago P.D. to get wind of what was going on."

For all the excitement it has generated, Operation Greylord may face problems.

"I never saw a star witness call his own press conferences before," the official said of Lockwood's talkative ways. "The normal format is for the U.S. attorney and the FBI to jointly announce that they have completed an investigation and evidence either will be presented to a grand jury, or they announce indictments. This . . . isn't the way the script is supposed to be written."

U. S. Attorney Dan K. Webb, who has said nothing about the investigation, last week announced establishment of a Greylord hot-line telephone number to receive corruption information.

"That's a panic step," one critic said. "You do that when you don't have enough on your own."

According to reports leaked to the media, the FBI seemingly has gone to great lengths to penetrate the court maze. The bureau established a bogus law office on LaSalle Street in the Loop, and agents posing as narcotics dealers, auto thieves and petty criminals got themselves arrested.

Many conversations are known to have been audio- and video-taped, with the FBI in possession of such masses of detailed information that it may take months to assemble evidence for a full grand-jury presentation.

Last weekend it was reported that about 20 lawyers and several judges have sought defense attorneys and that prosecutors will offer immunity to several Greylord targets in hopes of learning more about Cook County court operations.