An integrated circuit
That's right, the entire palace is one single computer chip.
The base price of the raw materials is laughable, a kg of semiconductor-grade purified monocrystalline silicon is just ~2000$/kg, cheaper even than gold.
The real price points are
Fabrication
ICs are hard to make. Current-generation fabs are in the price range of 18 billion USD and so hard to build that they're driving companies like Intel out of the business. And that is for 2-dimensional Wafers with a diameter of 300mm. Fabricating one wafer costs around 17,000$.
There's Fabs today that can build chips that are several hundreds of layers high - used for high-density SSD chips - but building a kilometer-high palace in one go?
Building a fab that creates that sort of 3D chip from one monocrystalline piece of silicon would be madness - exactly the right choice for your emperor.
Quality control
Wafers have defects, e.g. from pieces of dust in the atmosphere. This is one of the major price points for chip production; modern processes give around one defect per 10cm² of wafer area. Every chip on a wafer must be tested carefully for defects and thrown out - or have parts of it disabled - if a defect is found. In practice this means that a significant fraction of modern CPUs and GPUs are thrown away just as they're manufactured.
Naturally, the emperor's palace - manufactured in one piece from one monocrytalline piece of silicon - will need to have zero defects. Which may add a tiny bit to the manufacturing costs.
Unfortunately, a 3D chip will be really, really expensive to test since test probes can't just touch any part of the circuit...
Development
There's a lot of awesome things that can be done directly in silicon.
Apart from CPU cores, memory and storage you can build LEDs, capacitors, sensors for all sorts of things like magnetic fields, acceleration and pictures, protection diodes etc. 284
Your chip can be radiation-hardened, or be a solar cell. Naturally, the emperor's palace will have every feature.
Everything that can be conceived will be integrated into the palace.
The palace will not just be a chip for the sake of being a chip; it will provide functionality. There will be no need to install electric cabling, light switches or computer screens in your palace because the building is these things.
Fabricating a chip that has all kinds of different features at once won't be cheap - there's a reason they don't put RAM and CPU cores on the same chip, the required fabrication techniques are just too different.
Intel spends more than 10 billion dollars on research and development every year, and that's mostly just for incrementally improving CPU cores, nothing else. Intel CPUs are still quite cheap nevertheless because of economy of scale.
The emperor's palace, naturally, won't have any incremental improvements, or mass production. The Emperor can assign each cubic centimeter of palace wall to a different star system, and hold and pay for a great competition to see who can design the most impressive, most innovative cubic centimeter of wall, from scratch.
Every star system will assemble a team of their most brilliant scientists and engineers in an attempt to outcompete their rivals and impress the Emperor; especially if he tells them that cost is not an issue, and, in fact, he'd prefer things to be on the expensive side.
Of course, each cubic centimeter must be interconnected with the surrounding ones, and fulfill an actual purpose. Even having a few dozens of engineers working together on a complex project on Earth typically causes an immense amount of headache and management overhead, and makes your development costs explode far beyond what planned for. Luckily, that's an intended side effect.
Conclusion
The costs are literally inconceivable to me, but it definitely won't be cheap, and the emperor can add as much complexity, and show off as much complexity, as he likes. There's even nice synergy effects, if he chooses to share some or all of the beautiful technical advancements that are made while constructing the Fab or designing the Chips, similar to what happened with all of the money that was sunk into the Apollo project on Earth.
One important thing to get right from the start is Framing. It must be made clear that the project isn't supposed to be cheap, or efficient, but that it's supposed to be prohibitively expensive and stretch the limits of engineering, science and the general economy far beyond what seems reasonable. 634