Thomas O'Leary, at 32 years of age a seven-year inhabitant of the shadowy world of police informants, is certain he is headed to prison for a long time.

For O'Leary - self-described police "agent," skilled auto mechanic, freelance artist who paints, among other things, sad-faced clowns - is also a professional burglar who got caught. He now faces up to 40 years in prison for a string of selective thefts from the homes of affluent Washington suburbanites.

Prosecutors have suggested they may seek the maximum penalty when O'Leary comes up for sentencing Wednesday in Montgomery County Circuit Court. But O'Leary feels if he owes a debt to society, society owes him one, too.

He admits he periodically broke the law but did it in such a way, he says, that he never "put somebody's life in jeopardy. That's where I draw the line.That's my morality." At one time, he tried to make an honest buck by peddling "burglary prevention kits." Throughout it all he worked with state and federal authorities in the District, Maryland and Virginia to put other criminals behind bars.

"His cases were good cases," says Lt. Jim Elkins, director of Montgomery County's narcotics and vice division and the other O'Leary says he would "walk into hell with." He passed the small buys for "the elusive pound," said Elkins, and was instrumental in the arrest of 15 persons on drug-dealing charges in Montgomery County, two men for "contract" armed robberies, one for cocaine selling in the District, as well as others for bulgary, gambling prostitution and counterfeiting.

What O'Leary did as a police informant was, according to police, good for society. Whether it was good for him, too, is a question he and others are beginning to ask.

O'Leary's father, a man who at 55 says he is only now beginning to understand his son, puts it this way: "It was like placing an alcholic in a job tending bar. Tom has wanted to change for a long time, but what do you do? You can't get a job . . . He's been pushed into a situation."

"In one way," Elkins said, "it was psychologically beneficial to Tom, because he enjoyed doing it. Basically, however, it didn't help him. He's been harassed, stabbed once, shot once. In all honesty, it hasn't helped him."

Most of O'Leary's police work occurred while he was awaiting sentencing or on probation for various offenses. In two instances, according to Elkins and O'Leary, he carried on his work with the knowledge and encouragement of the judges who handled his cases, even though probationers generally are discouraged from such activity.

Jackson Lawes, parole and probation supervisor for Montgomery and Frederick counties, explained why it is discouraged. "We think it puts the probationer in an untenable position," he said. "It could have him involved in criminal activity. It also gives him some leverage. He could tell us to go . . . or whatever if he feels he's got some cop as a rabbi. By being responsible to too many people, he's responsible to nobody."

"We need people who are informants," said Elkins. "If they're on probation, it shouldn't make any difference to us. We use a lot of informants on probation . . . It's just a fact of life, the way we have to operate."

Thomas O'Leary, a 10th grade dropout with more street smarts than formal education, has been thinking while awaiting sentencing a lot lately about what his double life has meant to him.

"I do everything the man does but say, 'You're under arrest,'" said O'Leary, who does not like to be called an "informant." Yes, I enjoyed it. I did not enjoy and have the same feeling when I committed a crime and I knew I was going against society. Police work was a challenge and a calculated risk. It was a plus as far as keeping my head together."

But it was also a minus. "In essence, I made myself an outcast through my association (with police) on the street, and I'm an outcast as far as society is concerned, too. If there was no plice association, they (authorities) would have got down on me to get act together."

While working with the police, O'Leary said, "I always figured they'd say, 'O'Leary's done enough. Let's try and do something with him now. The only thing they're trying to do (now)," said O'Leary, looking ahead to a possible stiff prison term, is retire me until I'm 60 . . .

"I'm not trying to transfer the blame for what I did," said O'Leary, his collar-length hair set against a mod shirt open at the neck, his face outlined with a pencil-thin beard and moustache. But, he said, there are mitigating circumstances.

"It's the easiest thing in the world to make 500 (small) controlled buys," he says. For the big ones, however, "at any given time, you got 20 people to get past before you can close . . . I was able to get the pound or the man himself."

He did this at great risk to himself, he maintained. There have been, in fact, three attempts on his life, most recently Jan. 30 when he was shot in the shoulder as he emerged from an automobile in front of his Silver Spring residence.

Thomas O'Leary, second oldest of four children, was a teen-ager "out of parental control," his father said. After Tom and a girlfriend ran away from home, there was months spent in a reform school and weeks spent in a foster home, he said.

Thomas O'Leary committed his first burglaries when he was 18, fled to New Mexico where he was arrested, returned to Virginia to stand trial for a gas station break-in, escaped from jail, returned to Maryland where he did six months on an assault charge and had his driver's license taken away.

When he wasn't in jail, he says, he was looking for honest work but, with a criminal record, he found it difficult to find a job. Once as an employee, he said, he designed an award-winning Christmas window display for a drug chain that offered him a promotion as a reward but then fired him after learning of his record.

By the early 1970s, there were also a wife and two small children to support. It was then that Thomas O'Leary met Jim Elkins. O'Leary needed his driver's license back. Elkins needed help busting drug dealers and others. It seemed a natural match to both.

"He was still what I considered my enemy," O'Leary recalls. But O'Leary said he changed his mind after Elkins was instrumental in getting the driver's permit back.

O'Leary had another problem at the time. He had been charged with forgery and related crimes in a check cashing scheme. Elkins intervene - a plea bargain resulted - and the sentence handed down April 7, 1972, was five years probation.

The judge, O'Leary recalls, "said part of this probation was because of my assistance to police and my future continued assistance to police." Elkins remembers the judge "saying from the bench it would be well if he did cooperate with the police, but I don't think it was one of the conditions (of probation). The judge said continued cooperation would be beneficial."

Whatever the judge's precise words - the judge does not recall - O'Leary became deeply involved in police work.

"One time," Elkins recalled, "Tom ran aground with one of his probation officers because of working with us. Tom chose to ignore his advice (to stop), but the probation officer didn't do anything."

That is not always the case, however. Recently, The Washington Post reported how a Prince County man was threatened with revocation of his probation because of his continued work with police. That man's fate remains unsettled.

One night in 1973, O'Leary also ran afoul of his police pals when he was arrested after committing a burglary with another burglar who escaped. O'Leary said he had been directed to "get close" to his accomplice but had failed to inform his police contacts prior to the actual bulgary.

In return for future cooperation, the charges against O'Leary were, in effect, dropped, he said.

Reluctantly, he once testified for the prosecution, disclosing in open court much about his active role in informing on many criminals.

Over the years, according to Elkins, O'Leary received $2,700 for his Montgomery County plice work, plus lesser amounts from other jurisdictions.Besides this income, he scraped by with odd jobs, gambling and occasionally "gigs" of his own, which were ultimately his downfall.

In 1975, he was indicted in connection with nine burglaries in Montgomery and Prince George's counties. The victims were persons who had left town to attend funerals, earning O'Leary the title of the "obituary burglar." Judges in both counties threw the cases out on technicalities.

"After that," O'Leary said, "it would have taken a gun to get me back on the street."

But in the following year, during which he says he committed no crimes, he got far behind in the rent, the gas and electricity was shut off, he borrowed $1,000 from his father, tried to earn a living reconditioning used cars, all the while falling more deeply in debt. Then, he says, he heard from one of his former fences.

"Twice I turned him away," O'Leary said. But when his economic condition did not improve, "I called the guy back, borrowed $1,000 and told him I was going back on the street. I began in Silver Spring with a dozen burglaries just to pay the turkey back.

"Then, it got to be like a snowball going downhill. I figured, 'the hell with it,' I'd go over to Bethesda where I know there's monty. I figured by the end of the summer, I could get out and into something legit. But I got busted in July."

O'Leary was charged this time with 26 burglaries. In January, he pleaded guilty to four. His main wish now, he said is to go to federal rather than state prison for reasons of his own security.

"I'm certainly not proud of the thing he's done, anymore than he is," said his father, now unemployed and partly disabled. "But now that I understand him more I realize it takes a lot of courage to do the things he did, more courage than I have. There should be some kind of ledger . . . He's done a lot of good for society . . .

"I knew he was working with the police but I didn't know about the burglaries," George O'Leary said. "I knew he had to be out all night. We always assumed he was paid enough to get by. This hits me wrong, to keep him in this climate and not pay him enough to live. They almost put him in a position where to live he had to steal."

That's the O'Leary's point of view. Lt. Elkins, who still considers Thomas O'Leary a friend, has another:

"He's no dummy, but he won't apply himself to learn anything constructive," Elkins said. "he gears all his intelligence toward antisocial behavior. It's not just his record keeping him from getting a job . . . He's got a little slanted view of the world. We work for a living, pay the bills . . . His life is one gamble after another. His life is on the street . . .

"I think he thinks he wants to get off the street, but I don't think he's capable of it. It comes down to (the cact that) people have to be their own keeper. Knowing the differences between right and wrong is knowing where it's at. His basic flaw is he doesn't really know that . . .

"His prognosis now is jail and whatever comes with that," said Elkins. "It comes to the point where the community's more valuable than he is."