Dr Andrew McLellan, who was appointed Scotland’s Chief Inspector of Prisons last October, said he had been shocked at the "dreadful and unacceptable" conditions under which the sex offenders at the north-east prison were being forced to serve their sentences.
At least 60 prisoners, many of them elderly, are having to double up and share the smallest single cells in Scotland for up to 14 hours a day with no proper night sanitation, no power, and with as little as 3ft of leg room.
Dr McLellan claimed the prison was continuing to suffer from "chronic under-investment" and that urgent action was needed to improve the conditions for both inmates and staff.
He warned that a shortage of staff to prepare sex offenders for release under the prison’s award-winning STOP programme meant that sex offenders - the prisoners about whom the public were most concerned - were the least well-prepared for release when they left.
The report comes less than a year after the Scottish Executive was forced to scrap plans to close Peterhead by 2005 and transfer its 300 sex offenders to a new unit elsewhere in Scotland.
The Executive’s prison estates review recommended that Peterhead and Low Moss prisons should be closed and three new private jails built. It was claimed the scheme would save the country about 700 million, but the plan received little support.
However, many prison staff believe the latest report is indicative of a deliberate lack of investment in the jail, which will eventually force its closure.
Dr McLellan, a former Moderator of the General Assembly of the Church of Scotland, said: "All across the prison conditions are bad. In B-hall conditions are, I believe, as bad as they are anywhere in the Scottish prison service.
"A significant number of prisoners are sharing cells which have no sanitation, apart from a porta pottie. The fact that there is no integral sanitation, with no provision for decency or privacy whatever, is significant as a health risk."
Dr McLellan said his investigation of conditions at Peterhead had raised "questions about the unfair treatment of sex offenders" which had suggested "unhappy answers".
There was a suggestion that the SPS was operating a deliberate policy of treating sex offenders as second-class inmates.
Dr McLellan said: "That is a question that the Scottish Prison Service have to answer. My reflection here is that there seems to be some evidence to support it. It is certainly the view of all the prisoners in Peterhead, and most of the staff, that work with sex offenders does not get the priority within the Scottish Prison Service which it ought to get.
"There are certain circumstances which suggest that the way long-term prisoners are held in Peterhead suggests they are treated differently from all other long-term prisoners."
Dr McLellan praised the work being done by the prison’s STOP programme for sex offenders. He said there was "clear evidence" that the programme was making a difference. But he expressed his concern about the small number of prisoners who were going through the programme because of skilled staff shortages.
He said: "As a result, sex offenders, the very people whose release into the community causes most anxiety to the public, are those who are worst prepared for that release. That must raise a serious concern for the protection of the public."
Tom Fox, a spokesman for the SPS, dismissed claims Peterhead was being treated as a second-rate establishment.
"We don’t accept that," he said. "Peterhead, in common with a variety of establishments across the country, is sharing the consequences of record prisoner numbers. The whole of the prison estate has had to cope with the same sort of pressures."
He revealed, however, that the SPS was planning to invest 800,000 at Peterhead to provide electric power for the cells "as quickly as possible" and was also continuing to try to find a way of ending the practice of slopping out.
Stewart Stevenson, the Scottish National Party MSP for Banff and Buchan, said the damning report showed that the SPS was continuing a deliberate policy of running down the prison.
He said: "I suspect that the prison service management continue to want to close this prison. We won’t let them - none of us in this community. We are not going to allow civil servants to dictate public policy."
Cathy Jamieson, the Scottish justice minister, welcomed Dr McLellan’s report.
She said: "He points to conditions at Peterhead which fall short of what we should expect in a modern prison. The Executive is committed to tackling these, not just at Peterhead but across the whole prison system."
But she warned: "I am not going to promise there is going to be an overnight quick-fix solution to this."