Charles B. Lankford, who spent 20 years in prison for armed robbery and parole violations, then attracted national publicity three years ago in his unsuccessful campaign for sheriff in Fairfax County went back to jail on Monday, this time as an employe.

Lankford went to work as a cook in the Fairfax County jail run by Sheriff James D. Swinson, whom Lankford accused three years ago of running a jail plagued with security problems, homosexually and drug abuse.

Swinson, a Republican, defeated Lankford by about 16,000 votes out of about 85,000 cast in a bitter 1975 election campaign during which Lankford said that Swinson ran a jail so lacking in security "that an outsider could virtually take (it) over single-handedly."

During the campaign Swinson called Lankford "an unprincipled liar."

Yesterday, when he was asked about Lankford, Swinson said, "He was a political adversary and that's what he remains. That don't bother me at all, see."

Swinson said he hired Lankford because he needed a cook in the hail. The job pays $11,500 a year, according to Chief Deputy M. Wayne Huggins.

Asked if he was surprised that Lankford would apply for a job at his jail, Swinson, whose department has been under investigation for six months for alleged misuse of jail inmates, said, "I ain't surprised at anything anymore."

Lankford, 54, who was first arrested at the age of 16 when he used a wooden pistol to rob a man of $144 in Scenectedy, N.Y., said yesterday at the jail that Swinson is a "good guy."

In an interview cut short because he had to get back to the jail kitchen, Lankford said, "When I needed a job and nobody would give me a job, the sheriff did. It just goes to show you what kind of man the sheriff is."

Lankford, whose citizenship was restored by former Virginia governor Linwood Holton in 1972 because of his rehabilitation work with offenders, said he has been looking for work since March.

"I was the director of Friends of Women Prisoners in Alexandria, but I had to quit because they weren't paying me any money," Lankford said.

Friends of Women Prisoners Inc., an organization providing counseling and jobs for women offenders, was unable to pay Lankford his $15,000-a-year salary because it failed to get expected church contributions, according to Judith Roulstone, a counselor and social worker with the organization.

Lankford said he saw the cook's position advertised in a newspaper and applied for it because "I was a cook in the joint." Lankford moved to Fairfax County in 1968 after he was paroled on a 20-year sentence for robbing a bank in New Orleans. He served eight years on the bank robbery conviction in federal prison in Marion Ill., where he learned to cook.

Before running for sheriff, Lankford was the director of Offender Aid and Restoration for Fairfax, a volunteer organization that counsels offenders.

Democratic politicians in Fairfax yesterday said they were surprised that Lankford would take a cook's job in Swinson's jail.

Former Democratic supervisor Harold O. Miller, who pushed the supervisors into asking former governor Holton to grant Lankford's citizenship, said yesterday Lankford deserves a "more responsible position in the jail."