A Middleburg horse trainer, jailed two years ago in connection with a lovers' triangle murder that shocked Virginia's hunt country, has been found innocent in a second trial of trying to kill his estranged wife, whom he found in bed with a friend.

But in another of the twists that have laced this case, 30-year-old Theodore Gregory's continued freedom may now hinge on his challenge to his wife's divorce action. Under Virginia law, a divorce would free her to testify against him about the slaying of her lover.

Yesterday, a day after the not guilty verdict was returned by a Westmoreland County jury, the divorce court battle was already taking shape as Gregory's attorney asked the judge hearing the case to reopen it for additional testimony.

At the same time, Loudoun County prosecutors, stunned by acquittal, said they would seek an indictment against Gregory in connection with the shooting death of Middleburg horse dealer Howard LaBove as soon as the divorce is granted. LaBove was the man Gregory discovered making love with his wife.

"As long as he stays married to his wife, we can't seek an indictment, since she's the only witness to the shooting," said James E. Mechling, assistant commonwealth's attorney. "The longer the divorce proceedings, the longer we have to wait."

One of Gregory's attorneys, T. Brooke Howard of Alexandria, promised to contest any indictment of his client for murdering LaBove.

Meanwhile yesterday, Gregory, free for the first time in two years, was spending the day at his parents' Fauquier County farm, said his mother, Mrs. J. F. Gregory. "He's been out here taking care of the foals," she said. "It the acquittal is a nice Mother's Day present."

The trial that concluded Thursday in Montross, Va., marked the second time Gregory had been tried on the attempted murder charges since the Aug. 20, 1980, shooting. Gregory had been convicted of the charge in Loudoun County in December 1980. But that conviction was thrown out by the presiding judge because he agreed with defense arguments that he had improperly stopped a psychiatrist from expressing his opinion as to Gregory's state of mind at the time of the shooting.

Defense requests for a change of venue on the new trial were also granted, and the proceedings were moved to Westmoreland County, on the Potomac River about 75 miles due south of Washington.

According to trial testimony, often lurid and explicit, Gregory followed LaBove, a 6-foot, 4-inch, 220-pounder well known in Middleburg as a womanizer, and Gregory's estranged wife, Monique, from a dinner party in the small but exclusive town to LaBove's cottage. Gregory parked his pickup about 100 yards away, removed a .45 caliber pistol from the glove compartment and sneaked up to a window of the cottage.

He then entered the house, opened the bedroom door, and, according to Monique's testimony, announced, "I'm going to kill you, b----!"

In the ensuing scuffle, Monique fled naked to a neighboring house, her arms cut from the door's broken glass. LaBove was subsequently found dead with three bullet wounds in his chest.

Defense attorney Howard said yesterday that the jury acquittal was based on discrepancies between Monique's testimony and statements she gave to police shortly after the shooting. In addition, he said the jurors had little sympathy for her or LaBove.

"Not only was he LaBove a friend of Gregory's," said Howard, "but he was saying, 'Ted, don't worry, I'm doing all I can to bring about a reconciliation."

Prosecutor Mechling downplayed the alleged inconsistencies in Monique's testimony. "They were minor," he said, consisting of how many shots were fired, the location of the various individuals during the shooting, and other minor factors.

"They must have felt that, in spite of that the shooting . . . she was sort of asking for it," said Karen Donohoe, a spokeswoman for Commonwealth's Attorney Thomas D. Horne yesterday.