PRAGUE, Czechoslovakia (AP) _ Hundreds of soldiers and police officers stormed a prison today where inmates rioted and set fires, and one prisoner was killed and 30 people were injured, the state news agency said.

The report said authorities were forced to open fire on the inmates.

The riot at Leopoldov Prison began Wednesday afternoon when hundreds of inmates refused to be moved to other prisons. They were apparently being moved because of poor conditions at the facility, which repeatedly had caused unrest.

Slovak premier Milan Cic told the official CTK news agency that ''hand-to- hand fighting'' was required to clear the prison.

He said the facility was virtually destroyed by the fires the rioting inmates set to block about 2,000 soldiers, police officers and guards who tried to stop the riot and remove the prisoners.

One inmate at the prison 250 miles east of Prague was found dead in a ruined building after the inmates were evacuated, Cic was quoted as saying. Doctors said the prisoner died about four hours before troops stormed the prison buildings, and he was thought to have fallen to his death from a roof.

Twenty-nine prisoners and one prison guard were injured in the fighting, CTK said, without giving details of the wounds.

The news agency said authorities fired their guns, but only when absolutely necessary. The report said all 1,200 inmates were eventually moved to the Kurin jail in Bohemia or to prisons in Slovakia. Although Leopoldov housed hardened criminals and murderers, it also contained some political prisoners.

Most of the prisoners in Leopoldov were not affected by the presidential amnesty that released more than 20,000 lesser offenders at the New Year, just after former political prisoner Vaclav Havel took office as president.

Riots were reported at Leopoldov in January, and the inmates had staged sporadic strikes for improved conditions ever since.

Since March 1, inmates had occupied their cells and some refused food to press demands for abolition of provisions that allowed authorities to lengthen the sentences of hardened criminals.

Bratislava radio reported on Saturday that efforts by authorities to reduce the sentences of some inmates and negotiate with others had been hampered by what it termed the ''excessive radicalism'' of some.