The administrative court in Noumea has ordered immediate remedial work at New Caledonia's prison.
This comes just days after the French-based International Observatory of Prisons, OIP, lodged a complaint decrying the insalubrious conditions at the Camp-Est jail.
The court said hygiene deficiencies had to be dealt with, particularly a prison section made up of shipping containers.
It told the Justice Ministry that it must give the detainees the means to do their laundry and given the hot conditions, either repair or replace broken ventilators.
A local member of OIP said the court ruling was positive but timid.
There had been repeated calls to improve the conditions at the prison which was first opened almost 100 years ago.
Lodging its case, the OIP reminded the judges that the European Court of Human Rights this year found France guilty of breaching the human rights of prisoners in French Polynesia.
The European court also noted that the French authorities ignored court orders to remedy the situation.