A 27-year-old prisoner hit a deputy marshal in the face, wrestled her to the floor and grabbed her service revolver yesterday in what officers said was an attempt to escape from the Alexandria federal courthouse moments after he was sentenced to two more years in prison.

The woman and three other officers quickly subdued Harry Melvin Mayo in a cell block where he scuffled with Deputy Marshal Ruth Weygand, who had escorted him from the courtroom of District Court Judge Albert V. Bryan Jr.

The judge had just sentenced Mayo on two counts of mailing threatening letters to Assistant U.S. Attorney Carroll Weimer, an Alexandria prosecutor.

Prosecutors dropped another count against Mayo, charging that he had sent another threatening letter to District Court Judge James C. Cacheris, after the judge expressed sharp disagreement over the filing of the charge.

Earlier this year, Cacheris had sentenced Mayo to the 18-year sentence that he is serving in the Nottaway Correctional Center in Burkeville, Va. for a bank robbery in 1984.

Bryan, imposing the additional two-year sentence yesterday, said that "the letters cannot be allowed to go unnoticed."

"Mr. Mayo's only problem is he gets carried away when he starts writing letters . . . if you'd take his pencil away from him, he'd be fine," Bryan said before imposing sentence.

"Well, he was trying to get more than a pencil in his hand," said U.S. Marshal Roger Ray after Mayo's scuffle with Weygand.

Weygand, a 12-year-veteran with the marshal's service, said that when she took off Mayo's handcuffs to let him into his cell, he "hit me in the chest and tried to cover my mouth. Then he pushed me into a corner so we couldn't be seen on the television monitors upstairs and we scooted around on the floor."

"My biggest concern," she said, "was to keep him from getting the revolver."

Upstairs, secretary Ann Masters saw what was happening and alerted Ray, deputy U.S. Marshal David Williams and FBI agents Howard W. Luker and Jerry Graves, who ran to the cell block.

When they got there, Mayo had Weygand's revolver in his hand, according to Weygand and an FBI spokesman.

Mayo was brought before a U.S. magistrate yesterday and charged with attempting to escape and assaulting a federal officer.

"I'm telling you, it's a touchy situation," said Weygand who suffered bruises on her face and chest.

Weygand declined to give her age, saying that "it might be an embarrassment for him that he was subdued by [someone as old as] his mother."