A Washington doctor and a former Washington lawyer, who pleaded guilty to mail fraud involving false and inflated medical insurance claims, were sentenced to prison terms yesterday by a federal judge here.

U.S. District Court Judge Barrington D. Parker sentenced Dr. Marshall D. Nickerson, 39, to a total of six months in jail on one count to mail fraud and a second charge of illegal distribution of Dilaudid, a heroin substitute. Nickerson, whose office is located at 77 G St. SW, was also ordered to immediately pay a $3,000 fine in connection with the guilty pleas.

The lawyer, Harry I. Barnett, 42, was sentenced to serve a maximum of 30 months in prison on three counts of mail fraud, involving a total of $19,522 in auto accident claims. Barnett, who now lives in Ocean Ridge, Fla., was also ordered by Parker to pay a $3,000 fine.

The government's case against Barnett and Nickerson is part of an ongoing federal investigation of several local doctors and lawyers in connection with alleged schemes to defraud insurance companies through accident claims.

In one case, according to court records, Barnett falsely told two insurance companies that a client had lost several weeks wages and been treated by Nickerson, in order to collect about $10,000 as a result of an auto accident. In most cases, the records said Barnett received one-third of the amount recovered from the insurance companies plus medical fees.

As part of the investigation, information collected by the nonprofit Insurance Crime Prevention Institute revealed that Nickerson was the treating physician in 23 of 200 auto accident claims filed by Barnett since late 1975, the government said in court records.