Convicted spy Christopher Boyce was sentenced yesterday to 25 years in prison for several bank robberies in the Northwest while he was a fugitive from prison, and was told he must change his attitude if he ever expects to get out of prison.

Boyce, 29, was serving a 40-year prison term at the federal correctional facility in Lompoc, Calif., for espionage when he escaped in 1980. He pleaded guilty April 2 to two bank robberies in Idaho and admitted he took part in nine others.

Yesterday he pleaded guilty to five additional bank robberies.

U.S. District Court Judge Hal Ryan ordered Boyce to begin serving 25 years for the bank robberies after he completes the 40-year sentence he received in 1977 for selling CIA secrets to the Soviet Union.

Ryan said he had just returned from a tour of federal prisons. "They are very grim places, but places you can survive in," he told Boyce. "With the right attitude, you can work yourself to a better place. You can do good time or you can do hard time. It's up to you."

Boyce told Ryan, "I never meant to harm anyone and I never did."

But the judge said, "You have harmed all the people you threatened."

Ryan sentenced him to a total of 72 years on 21 felony counts of robbing banks, conspiring to commit bank robberies and breaking federal firearms laws. But he said the prison terms could run at the same time, making Boyce eligible for parole in 25 years after the 40-year espionage term and a three-year term for escape.