Alexandria police are investigating a Virginia health inspector who was assigned a key role in policing the city's massage parlors, according to law enforcement officials.

The investigation, an outgrowth of the prolonged federal probe into allegations of official corruption in Alexandria, is focusing on Richard L. Matthews, 36, a state employe who transferred from the city to a rural post in Fauquier County last spring. Investigative sources have said that Matthews is suspected of overlooking health code violations at the parlors in return for cash payments.

Matthews, in a telephone interview, denied the allegations. "I have a feeling that they are looking for a scapegoat," he said. "If they are, I'll just have to deal with it."

Because Alexandria officials depended on strict enforcement of health codes to control or curtail the massage parlor operations, the role played by state-employed health inspectors is said by the investigators to have been crucial to the parlors' continued operation in the city.

Alexandria vice squad officers found it virtually impossible to make arrests within the parlors. Earlier this year, after police recruited a volunteer civilian to solicit Alexandria masseuses, the cases were dismissed when defense lawyers claimed the action constituted entrapment.

tthe city code governing massage parl ors gave the health department the power to close down the establishments if violations of rules requiring cleanliness and workable toilets, among other things, were found.

In addition to their probe of Matthews, federal investigators are studying allegations that former Alexandria prosecutor William L. Cowhig accepted payments from a massage parlor operator who wanted to avoid prosecution.

A federal grand jury currently sitting in Alexandria is known to be investigating how the massage parlor network controlled by Michael Louis Parrish continued to flourish from 1976 until his operations were raided by the FBI in May 1978. Parrish moved most of his operations to Alexandria in 1976 after authorities in other Northern Virginia communities cracked down on his parlors.

Parrish told federal prosecutors, according to sources, that Matthews was reportedly paid $25 for each inspection in which violations allegedly were overlooked.

As far as could be determined yesterday, the only person to link Matthews with alleged payoffs was Parrish, who was convicted in U.S. District Court in Alexandria of prostitution and racketerring charges.

FBI agents interviewed Matthews' superior, H. Glenn Shoemaker, on April 5 and reviewed health department files on operating permits for two Parrish-owned parlors issued by Matthews and other inspectors.

Ten days later, Matthews, who earned $18,263 a year, left Alexandria to work as an inspector for the Fauquier County Health Department. Matthews said he took a pay cut to move to the rural county, about 40 miles southwest of Washington.

He said his decision to leave Alexandria was for "personal and professional" reasons. "I simply left on my own; I needed a change," Matthews said.

One source close to the investigation said Matthews' transfer was by "mutual agreement" with state officials.

On July 12, a federal grand jury probing alleged political corruption in Alexandria heard secret testimony from Matthews. He was the only health department employe called before the grand jury.

Matthews said in an interview that his role in policing the parlors was insignificant because the inspections were given "very low priority" by the health department.

Shoemaker, director of environmental health for the city, yesterday disputed Matthews' claim. "All our services are high-priority," he said.

City health inspectors visited the massage parlors four times a year, according to one official.The department's files contain inspection sheets from each parlor, noting certain sanitation requirements that were checked off, including clean floors, towers and toilets, and displaying the health department permit conspicuously.

The parlors could be shut down indefinitely until any violations were remedied. In the case of the massage parlors owned by Parrish, five lost business days could cost the organization up to $35,000 in revenue.