During the Nuremburg trials, The former head of the Kriegsmarine Karl Donitz was tried with convicted with breaching the second London Naval Treaty by carrying out unrestricted submarine warfare. However, he was not punushed, due to the Allies, particularly the United States, conducting the same style of warfare in the Pacific. So at least in that one instance, the defeated received fair treatment.
This was a pretty heavily-debated issue even at the time. The somewhat glib response to your question is: how are we defining fair? The accused were represented by counsel and they were able to present defenses. The judges were, ostensibly anyway, independent. There was at least one acquittal and not everyone was convicted on every count (or sentenced to death).
There is plenty of evidence that the Soviet judges, at least, had been instructed to find everyone guilty. Iona Nikitchenko, who both served on the commission that drafted the London Charter and as a judge on the tribunal, is on record as saying:
"We are not dealing here with the usual type of case where it is a question of robbery, or murder, or petty offenses. We are dealing here with the chief war criminals who have already been convicted and whose conviction has been already announced by both the Moscow and Crimea declarations by the heads of the governments, and those declarations both declare to carry out immediately just punishment for the offenses which have been committed."
Keep in mind that he had plenty of experience serving as a judge in show trials under Stalin during the 30s, so that sort of thing would have been business as usual for him. (For the judgment, he dissented on the grounds that they didn't convict and/or execute enough of the defendants).
If you read the minutes from the London Conference negotiations, which created the tribunal, it was pretty clear that everyone there (many of whom went on to be judges and prosecutors at the tribunal) took it for granted that the defendants had actually done what they were accused of. But it's also clear that they were concerned about accusations of "victor's justice" and wanted the trial be "fair" to legitimize it in the eyes of the world and posterity.
And there are also the legal issues surrounding the existence of the tribunals themselves. For instance: there were questions about the legitimacy of tribunals that the defendants' governments never authorized (or only did so under duress after a military defeat)--this one still gets trotted out by defendants in modern international tribunals, and there were ex post facto issues, since some (but not all) of the offenses charged weren't explicitly embedded in any treaties or domestic laws when they were committed. The judgment of the tribunal addresses these directly and that portion is worth reading for anyone interested in these issues. (The portion in the link does a good job of addressing those criticisms but in a nutshell the tribunal's response to them was: (1) the whole world got together to make this thing, how much more legitimate can you get?; and (2) there are lots of treaties out there that cover what was done one way or another and don't pretend like you didn't know that killing lots of people wasn't okay.)
While Nuremberg gets all the attention, the Tokyo tribunal (the International Military Tribunal for the Far East) had even more serious issues. For example, the Judge representing the Philippines was a survivor of the Bataan Death March, which you think might disqualify him but the tribunal didn't think so when the defense motioned to do so. The Indian judge, Radhabinod Pal, wrote a pretty blistering dissent criticizing the tribunal that's also worth reading.
As Judge Pal pointed out in his dissent, neither tribunal considered any possible crimes by the Allies so the trials were both narrowly focused on the accused rather than the entire context of what happened.
It's important to keep in mind, however, that this was all pretty new and revolutionary. The alternative to "victor's justice" (if we're going to call it that) is "victor's vengeance" and there were plenty of people who just wanted to execute them all right away and be done with it. The trials, as flawed as they were, were certainly an improvement on that.
It's also important to remember that it doesn't always make sense to view them the same way we would trial in our home, domestic legal systems. They arose from a combination of legal systems trying to work together, and while parts of them might not have been "fair" by US standards, for example, they were exceedingly fair by the standards of the Soviet system (to the Soviet judges' dismay). They were also dealing with much bigger events than any trial had ever done before and the parties involved were all doing something like this for the first time.
There were a lot of problems with the trials to be sure, and a lot of what occurred wouldn't fly in any modern international criminal tribunal. Were they completely fair? No, but one could make the argument that for all their problems, they were fair enough. Certainly they were more fair than defeated leaders could have expected up until then.
Edit: Used a wrong word. Sometimes writing these walls of text can be just as difficult as it is to read them.
There's the case of Radhabinod Pal, an Indian jurist, the only South Asian person appointed to the International Military Tribunal for the Far East's trials of Japanese war crimes committed during the second World War. Among all the judges of the tribunal, he was the only one who submitted a judgment which insisted all defendants were not guilty.
While finding that 'the evidence is still overwhelming that atrocities were perpetrated by the members of the Japanese armed forces against the civilian population of some of the territories occupied by them as also against the prisoners of war', he produced a judgment questioning the legitimacy of the tribunal and its rulings. He held the view that the legitimacy of the tribunal was suspect and questionable, because the spirit of retribution, and not impartial justice, was the underlying criterion for passing the judgment. Pal believed that the Tokyo Trial was incapable of passing a just sentence. He considered the trial to be unjust and unreasonable, contributing nothing to lasting peace. According to his view, the trial was the judgment of the vanquished by the victors; such proceedings, even if clothed in the garb of law, resulted in nothing but the satisfaction of the desire for vengeance. In his lone dissent, he refers to the trial as a "sham employment of legal process for the satisfaction of a thirst for revenge.". Furthermore, he believed that the exclusion of Western colonialism and the use of the atom bomb by the United States from the list of crimes, and judges from the vanquished nations on the bench, signified the "failure of the Tribunal to provide anything other than the opportunity for the victors to retaliate."
Judge Pal's typewritten book-length opposition to the decision was formally prohibited from publication by the Occupation forces and was released in 1952 after the occupation ended and a treaty recognising the legitimacy of the Tokyo Trials was signed by Japan. Pal's publication had also been prohibited in Great Britain, and it remained unpublished in the United States as well.
An add on question: some of the verdicts are time spent doing "hard labor". What was this hard labor?
To add to this question: Were allied soldiers also sentenced for war crimes comitted? Or only the defeated axis forces?
Were the Allied carpet bombings of cities legitimate?