To hear the lawyers talk, it was the great train robbery.

Alexandria attorney Victor M. Glasberg accused the Virginia Museum of Transportation of having "spirited away the locomotive . . . and hustled it out of town."

Not so, countered attorney Thomas A. Leggette. He argued that the Roanoke museum, not the North Carolina railroad buffs Glasberg represented, is "the rightful and lawful owners" of the 45-ton 300 horsepower locomotive.

It took a federal judge yesterday to decide who owns the historic engine, currently on display in Roanoke.

U.S. District Judge James C. Cacheris brushed aside the North Carolina complaint and ruled that the Virginia museum holds legal title to the 1944 H.K. Porter diesel, one of 25 left in the country.

"I'm disappointed," said Charles J. Moody III, a director of the East Carolina Chapter of the National Historical Railway Society in Bonsal, a small town near Raleigh.

"I'm pleased . . . we're very satisfied with the results," said Nancy McBride, executive director of the Virginia museum. "It was a very unpleasant situation."

The Virginia transportation museum has had the Porter, which McBride called "a tradition piece in the transition from steam to diesel," on display since it was acquired last June.

That acquisition enraged the North Carolina railroad buffs, who claimed theft and filed a $200,000 suit in federal court in Alexandria against the museum and the former president of the Virginia Central Railway of Fredericksburg, which once owned the industrial switcher.

Moody and his fellow train-lover, Thomas J. Johnson "I've been interested in trains all my life . . . ever since I won some trains in a contest at age 9" testified their group had been given the locomotive by David E. Wasserstrom of Melrose Park, Pa., the Virginia Central executive.

Since the group had no money, it asked the North Carolina National Guard to move the engine to its museum. The guard's schedule prevented any quick action so the group left it in Fredericksburg, they testified.

In the spring of 1985, the Virginia museum heard about the locomotive and contacted Wasserstrom. Surprised it was still in Fredericksburg, Wasserstrom said he told Virginia museum officials that if they removed the locomotive promptly, it was theirs. "We got the key, fixed up the train and even ran it," said Leggette.

Glasberg argued the Virginians' failure to call his clients -- "brothers in the love of railroads" -- was deliberate because they knew that "possession is nine-tenths of the law in Virginia."

"They could have moved it easily if they had simply asked their members for donations just like they did for this litigation," Leggette countered.

"It puts you back in your law school days," Cacheris commented. He said he believed Wasserstrom intended that North Carolina men would have to promptly remove the train from Fredericksburg to take possession of the train. The judge also said that Wasserstrom's October letter giving the North Carolinians the train was not a legal "deed of gift" because it did not have a notary's seal. "In short, I find no valid gift in this case."