A 40-year-old District man, the first person convicted here under a 1984 federal law aimed at habitual criminals, was sentenced yesterday to 35 years in prison for his role in an armored car robbery and sidewalk shootout last summer outside the National Museum of American Art.

"This is one of the most serious and heinous offenses that has come before the court in many years," U.S. District Judge John Lewis Smith Jr. told Horace Graydon Jr. of 36 G St. SW, noting that the "gunfire on a heavily traveled street" had endangered the lives of innocent persons.

The new statute, contained in the Comprehensive Crime Control Act of 1984, provides much stiffer penalties for repeat offenders who use firearms in the commission of a crime and who normally would be prosecuted under local statutes.

Graydon, who has four previous armed robbery convictions, was sentenced to a 15-year mandatory minimum sentence for armed robbery and a five-year mandatory minimum sentence for use of a firearm in commission of a crime. The two mandatory minimum sentences -- during which there is no possibility of probation or parole -- must run consecutively.

In addition, Graydon was sentenced to a minimum of 15 years, also to run consecutively, on three D.C. charges, including assault with intent to kill. Graydon's lawyer John E. Drury said the sentence "would relegate Graydon to incarceration for the rest of his life" and said he would appeal the conviction.

Graydon, who will not be eligible for parole until he is 65, is the second person in the last week to be sentenced to an unusually lenthy prison term by a federal judge here.

In an unrelated case last week, Judge Oliver Gasch sentenced a 26-year-old District man to 60 years in prison for selling two 10-ounce bottles of liquid PCP (phencyclidine) to an undercover D.C. police officer.

U.S. Attorney Joseph E. diGenova said federal prosecutors praised the long term, saying it was "another example . . . (that) shows that whether drugs or guns are involved in crimes, serious violators are going to receive severe prison terms."

According to Justice Department statistics, 11 persons nationwide were convicted under the new habitual criminal statute in 1985, the first year it was in effect. But prosecutions are expected to increase markedly under special joint federal-local programs already established by about 30 U.S. attorneys, Justice Department spokesman Tom Stewart said.

Officials of the joint program in Detroit estimate that they will prosecute 100 persons under the statute this year. DiGenova said that all local cases in D.C. Superior Court are now being screened to determine if the new statute can be applied.

Graydon is one of three persons convicted in the Aug. 23 armed robbery of a Federal Armored Express Inc. truck that was delivering coins and currency from area McDonald's restaurants to the Riggs Branch Bank branch at Ninth and F streets NW.

Don A. Shaifer, 24, of 2401 Southern Ave. SE, was sentenced to 10 years and Anthony K. Henry, 24, of 1724 Potomac Ave. SE, was sentenced to seven years.

While two armed guards were rolling the money into the bank, two men with handguns confronted them and one of the men struck a guard in the face with a gun.

As the two robbers were fleeing with bags of money, they exchanged gunfire with the guards while several bystanders dived for cover.

Assistant U.S. Attorney Zinora Mitchell told Smith that Graydon had shown "reckless disregard for the safety of others" and asked for the "most severe, most substantial period of incarceration that this court can lawfully impose."