A man recently released from a Michigan state mental hospital was shot in the head Saturday by the 64-year-old police chief of Haymarket, Va., after he allegedly attacked the chief and the town's 80-year-old municipan judge with a dining room chair in the judge's home.

The bizarre incident in the tiny Prince William County town (pop. about 288), whose police force is composed of one full-time and four part-time officers, was the first time ever that a town policeman had to fire a gun while on a duty, according to the town's police Commissioner and 20-year resident, Hugh H. Orndoff. The man was listed in fair condition yesterday in Prince William Hospital, a spokesperson said.

It began about 11:30 a.m. Saturday when Rector Robert Crewdson of St. Paul's Epsicopal Church saw a man without a shirt and socks standing by the road and shouting at one of Crewdson's neighbors.

Crewdson said he went out to see what has happening and brought the man - identified by Prince William County Polict as 33-year-old Raymond Charles Lewis of Houghton, Mich. - into the church's hall where Crewdson gave him a shirt and allowed him to wash.

According to Crewdson, Lewis said he had hitchhiked into Haymarket after being mugged and left in the District without money. Crewdson said he telephoned Haymarket's police chief, 64-year-old William V. Jones because Lewis was "talking irrationally and at times seemed like he was going to act violent."

Lewis began screaming again when Jones arrived and after calming him. Jones transported him to the home of 80-year-old Haymarket Municipal Court Judge Arthur C. Stickley at 14505 John Marshall Hwy., in order to help him, county police reported.

At Stickley's home. Lawis started shouting obscentities at the two elderly men and when they decided to put him in the county jail (there is no city jail), he became violent, picking up a wooden dining room chair and striking the judge on the head, police said. He then picked up another chair and hit Jones, who was not armed, in the face, police said.

A scuffle between the two Haymarket officials and the younger man ensued during which one room in Stickley's home and part of another one were "wrecked" by Lewis who toppled furniture and other items, police said.

Stickley managed to get a .22 calibre pistol he kept in a drawer and give it to Jones who shot Lewis in the head, officials said. Lewis then dove through the screen in an open window and ran to the front of the house.

There he was spolted by a county police officer who apprehended him. He was eventually transported to the Prince William Hospital, police said, where he was placed under a 24-hour guard and held on $15,000 bond. He is being treated in the hospital intensive care ward for head wounds, the hospital said.

Police subsequently learned that Lewis had been released from the Newberry State Mental Hospital in Newberry, Mich., last May.

Stickley, who is a former Arlington County Judge, according to Orndoff, and has been on the bench in Haymarket for about 25 years, was admitted to the hospital for observation with a gash in the back of his head.

Reached by telephone yesterday Stickley said he was "all right" but he refused to discuss the incident.

Jones who was treated for a broken nose and released said yesterday he was "okay" and would have nothing to say "until after the investigation." Asked what investigation he was referring to, he declined to elaborate.

Ordoff said he thought there would be a "complete investigation by the county police since the incident occurred in their jurisdiction. He said he didn't know what the town council might do about the shooting but added that "there could be (a special council meeting) in relation to this."

Jones, whom Orndorff characterized as "pretty cool," continues to serve on the town's police force which he joined for the second time in 1975. He had previously had worked as a police officer in Haymarket from 1960 to 1967.

Prior to Jones' appointment as the town's single police officer in 1975 Haymarket had been without a police for six months because there was no money in the town budget to pay for one.

However, after budgetary maneuvering the town council managed to find funds and hired Jones to staff the town's one-room police station and to patrol Haymarket's half-dozen Street. Jones now has four part-time officers working under him.