The former attorney for a Quantico Marine who is serving a 30-year sentence for the attempted murder, rape, sodomy and kidnaping of a woman on the base yesterday characterized his client's conviction as "a miscarriage of justice."

Ervan E. Kuhnke Jr. of Dumfries, who was the lawyer for Pvt. Lindsey Scott in his October 1983 court-martial, maintained during a hearing that he gave the serviceman the best defense he could.

The lawyer, a former CIA officer, said, however, that "I am convinced that . . . it would be difficult, if not impossible, for a black man to have a fair trial in this case" at Quantico. Kuhnke testified for six hours yesterday in a military hearing on whether he had represented Scott effectively at the court-martial.

The case attracted national attention 16 months ago when civil rights groups said that Scott became a suspect almost immediately after the crime against the white woman because of pressure from senior Quantico officers for a quick arrest.

Lt. Col. J.M. Messer, the military prosecutor in the case, said at the hearing that Kuhnke's comments were "sour grapes because you couldn't deliver what you promised in this case, which was an aquittal."

Scott testified Tuesday that he chose Kuhnke from an advertisement in the Yellow Pages.

Prosecutors in the court-martial said the woman was lured from her off-base apartment by a black man who telephoned, identified himself as a military policeman and said her husband had been involved in an accident. The man then picked her up in a car and drove her to a remote area of the base, where he raped, choked and stabbed her, then left her for dead, they said.