Troubles install Xcode 5 on Mountain Lion
I had a similar problem with one of the Xcode 4 versions.  What worked for me was to log in to Apple Developer Network (this will work with your free developer account login), at https://developer.apple.com/xcode/

Although that page says to get the most recent version of Xcode at the App store, there is a link that says "For past versions of Xcode or additional tools -- view downloads".


Click the downloads link
Unselect all of the checkboxes on the left except "Developer Tools", type "xcode" in the box at the top of the left column, and hit Enter
The top result will be Xcode 5 - click the disclosure triangle to view the download link for it.
Download the .dmg, double-click on it to mount it and run the installer


Note that the downloads page says that Xcode 5 requires OS X 10.8.4.

As I mentioned, this worked for me when the App Store locked me out with one of the Xcode 4 versions.  If this happened to you, please leave a comment indicating whether this solution works for you.