Three former Alexandria police officers appeared yesterday before a federal grand jury in Alexandria that is investigating allegations of wrongdoing in the city's police department.

Their secret testimony to the federal panel came five days after a special state grand jury completed a similar inquiry. The scope of the federal inquiry is not known. Assistant U.S. Attorney Justin Williams, who is in charge of the investigation, and his superior, U.S. Attorney Elsie L. Munsell, have declined to comment.

Earlier comments by city officials indicated that the federal investigation, unlike the state inquiry, seems to be focusing on allegations of illicit wiretapping by city police. When the state inquiry was completed Wednesday, Fairfax County prosecutor Robert F. Horan, who assisted that investigation, said he believed the federal inquiry was covering the same issues that the state panel addressed.

That jury said it found no evidence to support allegations of misconduct by Public Safety Director Charles T. Strobel or other Alexandria police officers. The 11-member panel praised Strobel's department for "functioning in a highly professional and enthusiastic manner."

Thus far, four former Alexandria officers are known to have testified before the federal jury.

They are:

* Norman E. Grimm, 54, a police captain who resigned in February 1979 after disclosures that he allegedly suppressed results of a polygraph test on Alexandria's then-prosecutor William L. Cowhig in which the prosecutor was questioned about allegations that he solicited a sexual favor from the wife of a criminal defendant.

* Robert Osbourne, a former police examiner who conducted a polygraph test on Cowhig. Grimm was the immediate supervisor of Osbourne, who runs a polygraph business.

* Greg Rippey, 32, who served seven years on the department before resigning last year. He was an investigator when he left the force.

* Louis Pugh, 33, a former detective who is now a Prince William County deputy sheriff. He testified before the federal jury in early February and also appeared before the Circuit Court grand jury. He has alleged that Strobel stopped him from investigating tips linking two police officers from Fairfax County to a 1971 murder in Arlington. That allegation was rejected by the Circuit Court grand jury as unsubstantiated.

Cowhig resigned his post in l979 after allegations about his sexual encounter became public. He was disbarred the following year and has recently applied to have his law license restored.