Anatoly Scharansky, the Soviet Union's most famous political prisoner, hand weaves potato sacks in his cell and suffers frequent headaches, an inmate just freed from the same jail said today.

"The normal is eight sacks a day, but he only makes a few, perhaps because he is not used to working with his hands," said Hillel Butman, who was released last week and surfaced in Moscow to describe prison life.

Scharansky, who was sentenced last July to 13 years for treason, is in Chistopol Prison in the Tartar Republic about 500 miles east of Moscow, Butman said, and despite the headaches he is "very joyous and rather optimistic."

"When a man has hope, he hopes, he waits, and he lives," Butman said in a conversation here describing Scharansky's life in the infamous Soviet prison system where political prisoners and common criminals cooperate to survive the harsh regime.

Butman's tale is the first direct account to reach Western correspondents of how Scharansky copes with prison existence. A major figure in the Jewish emigration and dissident movement, his trial last summer led to a chill in Soviet-American relations and brought a world-wide outcry from human rights supporters.

Butman and four other Jewish activists, imprisoned in 1970 for their part in an attempt to flee the country by hijacking a plane from Leningrad, were ordered released last week by Soviet President Leonid Brezhnev. They had 14 months of their 10-year sentences still to serve, but received exit visas in what is seen here as a gesture toward the United States on the eve of a new strategic arms agreement.

Butman, 45, said he was incarcerated in cell number 61 on the second floor of Block 1 at Vladimir Prison near Moscow and Scharansky was on the third floor several cells over until they and other political prisoners were moved by prison train to Chistopol last Oct. 5.

He said the cars looked normal from outside, with windows painted to hide strong interior bars over them.

"As usual," he said, "outside everything is all right and inside everything is all wrong."

In late February, he said, Scharansky was sent to 15 days' solitary confinement after prison guards caught him sending messages to other political prisoners. He also was deprived of one of two scheduled meetings with his parents this year.

Scharansky's present cellmate is Viktoras Pyatkus, a Lithuanian Catholic historian and activist who was sentenced the same week as Scharansky to a maximum of 15 years' prison and exile on charges of anti-Soviet agitation.

Butman said the communications network at Chistopol first centered on the communal washroom. Prisoners took soap, softened it and buried messages inside, then stuck the gluey mass to the backs of washbasins and tables. When this was discovered, he said they began stripping small magnets from cupboard latches and using these to fasten messages to table legs and other metal objects.

Finding themselves at one point locked into adjoining cells at Chistopol, Butman said he and Scharansky resorted to a communication system long used by Soviet convicts: the toilet. Each bailed water out of the fixtures and waiting until the commotion of a changing of the guards covered them, they shouted into the toilets and their voices carried through the common waste pipe into each other's cells.

Later, Butman was moved to another cell further away, but said he and the other prisoners continued to communicate with Scharansky in ways he would not reveal. The guards, he said, had discovered and put a stop to the other methods. Nevertheless, he said, "as the Russian saying goes, 'Every poison has an antipoison.'"

Butman said common criminals-rapists, murderers, swindlers, and others-help pass messages in the prisons. "They make this work with pleasure because they are adventurers and seek adventure," he said. "They like it. They are great masters of making connections. If we have success, we get a message. If we fail, we get solitary or are deprived of a meeting."

Butman said he was sent to Vladimir Prison and then to Chistopol from a strict-regime labor camp as punishment after he objected to a guard's eating prisoners' food. The others in his recently freed group are Anatoli Altman, 36; Leib Khnokh, 35; Vulf Zalmanson, 39, and Boris Penson, 33. All five were present today at the apartment of Andrei Sakharov, the human rights leader. With their closely shaved heads, sunken eyes and pale skins, they reflected the ordeal of labor camp life and the wrenching surprise of sudden release and imminent emigration. All are staunch Zionists.

They said they were kept in labor camps Numbers 35, 36, and 37, all in the Perm area in the Urals. They said all political prisoners such as Scharansky have been moved out of the Vladimir Prison, about 100 miles east of Moscow in an old city frequented by tourists. They think this is because the Soviets want no political prisoners there during the 1980 Olympics, when tourist crowds are expected to increase.

Altman said he met Yuri Orlov, a human rights activist and a founder of the Helsinki monitoring group in Moscow formed to check Soviet compliance with the human rights provisions of the 1975 Helsinki accords signed by the Kremlin.

Orlov was sentenced to seven years in the camps and five in exile for anti-Soviet slander. Scharansky, accused of being a CIA agent, was given three years in prison and 10 in the camps.

Altman said he became Orlov's lathe teacher in the Perm camp, and that Orlov was a quick learner. He said Orlov "took a very lively interest in the camp, asked detailed questions about each person, why they were there, what their views were, their relatives, their future plans."

He said Orlov challenged the camp authorities for legal infractions and as a result, he was sent to a camp called "the Little 37 Zone," where the worst common criminals are. "Now he's in complete isolation; that's the worst thing," Altman said.

The men said that few letters ever arrived for them and their own letters out apparently had been frequently stopped, but they said occasional contacts with relatives and communications from outside keep the internal prison camp communications system at work. CAPTION: Picture, Soviet dissident Anatoly Scharansky spends time in prison weaving potato sacks. Union of Councils for Soviet Jews