Compared to what we already have, for example the Chandra X-ray Observatory that already has the orbital path one third as long as the distance from the Earth to the Moon (apogee 133,000 km and perigee 16,000 km, or 83,000 and 9,900 miles respectively), I don't think there's enough incentive to put a similar observatory on the surface of the Moon. There are a few advantages, but as you can probably guess, they don't outweigh all the disadvantages. At least not for the time being. Let's see how they stack up, assuming a Moon based observatory versus an orbited one:
- Earth Interference: In favor of the Moon based observatory, provided you build it on the far side of the Moon, or your subject of study is the Earth and its magnetosheath that is visible in the X-ray glow caused by particles from the Sun colliding with the gas trapped within the Earth's magnetic shield, something that has actually already been proposed to the NASA for consideration before, in the form of the MagEX (Magnetosheath Explorer in X-rays). And since the Moon and the Earth are tidally locked, the Moon always shows the same face towards the Earth, and the far side of the Moon is always facing the other way. This might prove beneficial to your sensitive equipment, and their measurements not being interfered with the Earth's own or reflected radiation. The Earth's magnetosheath emissions in the X-ray spectrum stretch way beyond the Earth's own size, so this is something orbited observatories might need to constantly adjust for, and possibly lose a great deal of resolution / vision in the process, as they navigate through it. Think of it in a similar sense as areas of varying density fog in front of optical telescopes. You would be free of this interference by placing your observatory on the far side of the Moon
- Cost factor: Greatly in favor of the orbited observatory. The Moon based observatory, if placed on the far side of the Moon, would require some communication relay station, possibly another satellite tasked with it and orbiting the Moon. Orbits around the Moon are not really stable, because of its gravity anomalies, so any long term orbits would be hard and costly to achieve. You would also need at least three, possibly more of communications satellites orbited around the Moon, if communications without interruptions are your requirement. It is also, of course, a lot more expensive to launch all the required equipment to build it first to the TLI (Trans-Lunar Injection) trajectory, and later land it on the Moon, than orbit the same weight or possibly even lighter observatory in any high altitude orbits around the Earth. Your Moon based observatory will also have to be either self-assembled and anchored, or you'll need other equipment there, maybe even astronauts and/or robots, all adding to your total weight, and with it cost. If your Lunar observatory is placed on the near side of the Moon, then of course you don't require additional satellites orbited around it, but the total weight and your launcher requirements will still be much, much greater than those of an orbiting observatory.
- Risk factor: Again, greatly in favor of the orbited observatory. We have ample experience in lifting, orbiting, self-assembling, and controlling attitude of satellites in orbits around the Earth, but we don't have nearly as much of experience in doing that on the surface of the Moon. In case of a costly to ignore failure of the satellite, we could probably (currently not, but in the not-so-distant future by all means) send astronauts-technicians there to repair it a lot easier than sending them to the Moon. And since the Moon is a body with no magnetosphere or atmosphere (it has an exosphere, but that's irrelevant for this), it is constantly bombarded by Solar wind, has no protection against CME (Coronal Mass Ejections) and attracts asteroids with its mass that will impact on its surface, no matter how small they are. There is also plenty of dust mixed with regolith on the Lunar surface, which tends to jump up seemingly on its own accord and completely random (there are several theories behind this phenomenon, the prevailing theories attributing it to static charge and/or Helium plasma, both due to Solar wind and CME), so there is a potential for your expensive equipment degradation due to dust particles a lot faster than with your orbited satellite observatory.
- Targeted, long period observations: This goes, for the most part, in favor of the orbited observatory. While you'd have to have constant attitude control in place to be able to point at a single location in space for a long time, your Lunar observatory would be completely hopeless regarding this, and rotate together with the Moon rotating on its axis. For shorter period sweeps, you'd be fine, but not so much for precise measurements over longer periods of time.
- Self-sustained power: This is a bit moot point and could go either way, favoring one or another, but it should be mentioned nonetheless. While the Moon is tidally locked with the Earth, it's not locked to the Sun, so it still has day/night cycles. But the Lunar synodic period lasts on average roughly 29 days and a half Earth days. Half of this time, any stationary on the Moon's surface positioned equipment will be in complete darkness. This is not a good news, if you plan to power your observatory with solar cells, and you'll then require large and heavy batteries to store your electricity requirements for the dark period. It is an easy enough task for your orbited observatory, though. It's something we have done many times before. You could of course bypass any of these drawbacks of RPG (Renewable Power Generation) and simply rely on the power provided by decaying radioisotopes in RTG (Radioisotope Thermoelectric Generator), but then you start dealing with the tree-hugging people or other political agendas trying to stop your endeavours, so you might spend more money on the medication required to numb yourself senseless, than on the actual mission. I said it's a "moot" point, didn't I?
So there we have it. There are some advantages to be had, but come with serious disadvantages (or maybe more drawbacks?) of placing an X-ray observatory on the surface of the Moon. To answer the question in the title more directly though:
Would placing an X-ray telescope on the surface of the Moon be a good idea?
There are no obstacles that would explicitly prohibit us in doing so, merely challenges we have yet to learn to defy. Taking on all these challenges head-on in a single project would probably be a foolish waste of hard to come by funds for scientific research, but eventually we will get to the point when we'll look back and say, my, haven't we done well to have come thus far? But even now, when all the pro et contra are weight, there might be projects that would greatly benefit by having an X-ray observatory placed on the surface of the Moon and are possibly worth taking the risk, like for example the MagEX one I mentioned earlier that neatly avoids all of the major hurdles by calling for its placement on the near side of the Moon.
We have however so far done pretty well without going that extra mile, and the Chandra X-ray Observatory has an exemplary track record with planned lifespan of 5 years, yet it's still providing us with valuable data good 14 years after it was launched in the July 23, 1999. Granted though, completely free of interference - that it isn't.