This is an interesting question, since we cannot know precisely what cause the nuclear destruction in "If I Forget Thee, O Earth" by Arthur C. Clarke. This story is set in some future time in a lunar colony, probably the moon. A ten-year-old boy, Marvin, has never been outside the colony, but today his father takes him in a lunar scout car to the other side of the planet so he can show his son the earth--or what is left of it.
What Marvin sees takes his breath away, as he recognizes water and continents he had studied but never seen.
Then Marvin, his eyes no longer blinded by the glare, saw that the portion of the disk that should have been in darkness was gleaming faintly with an evil phosphorescence: and he remembered. He was looking upon the funeral pyre of a world—upon the radioactive aftermath of Armageddon. Across a quarter of a million miles of space, the glow of dying atoms was still visible, a perennial reminder of the ruinous past. It would be centuries yet before that deadly glow died from the rocks and life could return again to fill that silent, empty world.
Marvin can see that there has been a nuclear war which is gradually killing the planet. This sight saddens Marvin and he realizes that he will never be able to leave this planet; his descendants may one day get to do that, but for him the earth is forever inaccessible.
So, at last, Marvin understood the purpose of this pilgrimage. He would never walk beside the rivers of that lost and legendary world, or listen to the thunder raging above its softly rounded hills. Yet one day—how far ahead?—his children's children would return to claim their heritage. The winds and the rains would scour the poisons from the burning lands and carry them to the sea, and in the depths of the sea they would waste their venom until they could harm no living things. Then the great ships that were still waiting here on the silent, dusty plains could lift once more into space, along the road that led to home.
That is what happened, but your question asks what could have been done to prevent this nuclear destruction. The answer can only be given in general terms, since we have no way of knowing exactly what prompted who (or how many) to use nuclear weapons.
Obviously the best way to prevent a nuclear holocaust is to eliminate all nuclear weapons; unfortunately, this is a world in which trust between many countries is strained and weapons play a role in keeping a balance of power between them. Unless all of them are eliminated from all countries at the same time--a virtually impossible task--there will always be nuclear weapons.
Since that is the case, the next best strategy to keep from having a nuclear Armageddon is to follow the doctrine of Mutual Assured Destruction, a policy which uses weapons as a deterrent to a nuclear strike. While there are countries who do not align themselves with the rest of the world in these areas (such as Iran and North Korea), the policy is commonly adhered to by the countries which have the weapons. Whether it is a wise or judicious policy can be debated; however, it does seem to have worked.
That certainly does not mean it will always be enough, so efforts must continue to control and then eliminate the kinds of weapons who could literally turn the planet dark except for a radioactive glow, like the one Marvin sees in this story. This story was set in a time when nuclear bombs had been dropped; the threat is different today but just as real.