Two HIV-positive men are taking on the Zambian government in a legal test case that could force a major overhaul of the country's jails.

George Mwanza accused officials of violating his human rights, and those of other inmates with HIV, by failing to provide adequate care in prison. "I have been prevented from accessing the antiretroviral [ARV] drugs and therapy from the clinic," Mwanza told a court on Monday, watched by Aids activists wearing white T-shirts in the public gallery.

Mwanza and Melvin Beene, a co-plaintiff who is also HIV positive, argue that, while incarcerated at Lusaka central prison, they did not receive the quantity and quality of food needed to ensure that ARVs are fully effective. Mwanza said his diet consisted of a maize meal for breakfast, and porridge with beans or anchovies for lunch. He did not receive dinner. Often the food was uncooked or rotten, he added.

People who are HIV positive are advised to eat a varied diet of eggs, meat, fruit and vegetables. ARVs can have side-effects if taken on an empty stomach. "The last time I had an egg was in June," said Mwanza, who is awaiting trial for statutory rape.

The pair allege that poor prison conditions – including lack of ventilation, unsanitary toilets and overcrowding, causing them to have to sleep sitting or standing – had a negative effect on their health. Mwanza and Beene also claim that they were denied access to their ARV treatment on numerous occasions. Prison staff shortages mean the government is unable to provide enough wardens to escort them to clinics.

More than one in 10 Zambians is HIV positive. The case is being watched closely because of its potential ramifications for the way Zambia treats its prisoners.

Mary Chisanga, acting projects officer of the Legal Resources Foundation, which is representing the men, said: "They argue they are not being served with a balanced diet as advised by medical officials to ensure the full efficacy of their treatment. They also argue they are in a congested prison cell with poor ventilation and that is an infringement of their right to health. The issues of congestion, poor ventilation and food portions affect all inmates. This will set a precedent."

Mwanza spent some time in a holding cell containing 1,967 people but built for 400, she said. He has suffered continuous diarrhoea and contracted tuberculosis twice, he told the court. Chisanga added: "At the time George Mwanza brought the case he was looking much better than now. We are trying to get a doctor to look at him."

Priti Patel, deputy director of the Southern Africa Litigation Centre, which is following the case, said: "Prisons in Zambia are incredibly overcrowded. As far as we know there hasn't been a case like this before. It could have repercussions for what the prison has to provide to HIV-positive prisoners and indeed all prisoners."

The Zambian government argues that additional food is supplied by charities and NGOs, but Mwanza contends this is irregular and cannot be relied upon. The government denies the allegations of poor prison conditions and claims that there is a clinic on the premises to provide treatment to all HIV-positive inmates.

In 2010, Zambia's jails were branded "death traps" by Human Rights Watch. Its investigation found that prisoners routinely live in overcrowded cells where there is no room to lie down at night, forcing them to sleep in shifts, pressed against one another. Medical care was almost non-existent.

Common punishments include being stripped naked and held in solitary confinement in small, windowless cells, in water up to their ankles or calves contaminated with the prisoner's own excrement, sometimes for days on end.

"Zambian prisoners are starved, packed into cells unfit for human habitation and face beatings at the hands of certain guards or fellow inmates," Human Rights Watch said at the time. "Children, pregnant women, pre-trial detainees and convicted criminals are condemned to brutal treatment and are at serious risk of drug-resistant TB and HIV infection."

At the end of Monday's hearing, the judge adjourned proceedings until 11 March.