When a Martinsburg, W.Va., jury acquitted two horseplayers accused of tax violations by the Internal Revenue Service, the verdict represented a triumph for justice. But the trial also suggested that justice is a very rare outcome of confrontations between gamblers and IRS agents.

The two days of testimony in U.S. District Court provided insights into the methods and motivation of the agents, who were trying to prove the defendants' guilt. As one defense attorney agrued: "They forgot that our constitution guarantees a presumption of innoncence.

For every horseplayer like Lynn Largent Sr. and Youelle (Willie) Logan who have an impartial judge and jury to protect them, there are hundreds who must have one-on-one battles with the Irs. In these situations, the agents are, for the most part, free to bully their prey, with few checks on their actions.

The IRS can harass horseplayers with devilish efficiency because it has constructed a system for dealing with gambling winnings that is full of Catch-22s. In some cases, the system practically forces an otherwise honeset man to commit a crime, for which the IRS will then swoop down on him.

This was the unhappy fate of Joseph Workman. The Fisherville, Va., funeral director makes about 10 trips a year to the track and like most amateur handicappers, he loses in the long run. Even after hitting a Big Exacta worth $846.40 at Shenandoah Downs, he would very likely finish 1978 in the red.

A gambler must pay taxes only on his net winnings for the year. If Workman had not net winnings, he would have no tax liability and nothing to hide from the IRS. Even so, he turned his Big Exacta ticket over to a 10-percenter who cashed it for a fee, filled out the required tax information form and enabled Workman to keep his identity concealed from the government.

Why would a rational man pay money to commit a felony when he could save money by being honest? Every horseplayer understands the reason, and even IRS agent Larry Mincks testified to it in the Martinsburg trial. "People cash tickets illegally for a variety of reasons that sometimes don't have to do with taxes," he said. "Sometimes, they just don't want to fool with the IRS."

A horseplayer who fills out Form W-2-G honestly, and later claims losses to offset his winnings, will very likely have his tax return audited and greeted with reactions ranging from skepticism to utter disbelief. He will be asked to prove his losses, and because of the nature of the game, race-track losses can never be definitely proved. Losing tickets - the only thing close to a receipt - can, after all, be picked off the floor. So many horseplayers have had so many negative experiences when they try to claim legitimate losses that the popular racetrack wisdom holds that it is wiser to employ a 10-percenter than to sign Form W-2-G. Workman was only doing what thousands of other bettors do. His mistake was getting caught. (He avoided prosecution for a felony by testifying against the 10-percenter.)

The IRS treatment of gamblers becomes most unfair - in fact, sinister - when two or more bettors share a lucrative ticket requiring them to sign the tax form. If they go to the cashier's window and ask to sign it jointly, they will be told that this cannot be done. One person must take responsibility for the winnings.

And yet the IRS agents say otherwise: "If several people are involved in one ticket, several forms are filled out," Mincks testified. Either he was ignorant of actual race-track practices, or had other motives regarding Largent, who had shared a Big Exacta ticket with a partner who filled out the tax form.

While Largent was acquitted, another West Virginia horseplayer in a similar position wasn't so lucky. He shared a winning Big Exacta ticket with another bettor, and because his partner signed the tax form, he was not permitted to. The IRS then charged him with a felony. The befundled horseplayer (on the advice of his befuddled lawyer) pleaded guilty.

Even the most repressive totalitarian state would have difficulty devising such a trap: a situation in which an honest man finds that every possible course of action open to him involves a felony.