BEIJING has granted a jailed dissident journalist bail to seek medical treatment in an apparent sign that it is willing to improve the country's human rights records. Chinese sources said yesterday that Qi Lin, an assistant foreign editor of the Beijing Daily who was given a four-year prison term last April, was given medical bail late last year. However, Qi's ''crime'' of ''leaking state secrets'' still stands and he could be hauled back to jail at any time. A source close to the Qi family said the journalist, who was accused of providing classified information to a mass-circulation Taiwan newspaper, had been given temporary bail mainly because the authorities feared he might die in jail. Qi, 36, is suffering from acute diabetes, for which he could get no adequate treatment in prison. The family friend said that after returning home Qi and his wife, a teacher, had had difficulty meeting the huge medical fees. ''Qi should ideally get an anti-diabetes injection every day, which costs 80 yuan per shot,'' the friend said. ''The couple also has to take care of a child who is going to primary school.'' It is understood that Qi, having been ousted from the Beijing Daily, is too weak to look for jobs or take up another career. Former associates quoted Qi as saying he would concentrate on recuperating and that he might make an appeal after his health had returned to normal. The family hopes Qi can be allowed to go abroad for medical treatment, but analysts said this was unlikely unless the ''crime'' against Qi was quashed. Qi was detained by Beijing security forces in July 1991 and was put on a closed trial in February 1992. The ''state secret'' referred to the news that the former editor of the People's Daily, Mr Hu Qiwei, had received disciplinary action for his role in May 1989 of trying to convene a special National People's Congress to invalidate martial law. Human rights activists said that, while Beijing's handling of the Qi case might be a sign of flexibility, the security apparatus had continued to arrest or harass journalists suspected of talking to foreign media. Beijing has also continued to jail dissident journalists, including those who are in even worse health than Qi, they said.