Not only may the city led astray into idolatry not be rebuilt, no one is to make use of the wealth of such a city. The reason for this is similar to the prohibition against deriving benefit from any object that was used for idolatry, as in Mitzvah #249: we must distance ourselves from idolatry in all ways. So, not only may we not rebuild a city led astray, we may not utilize any objects that may have managed to avoid destruction. This, too, perpetuates the idolatrous legacy of the ir hanidachas.
This mitzvah only applies at a time when the Jews reside in their land and there is a functioning Sanhedrin. It is discussed in the Talmud in tractate Sanhedrin on page 111. It is codified in the Mishneh Torah in the fourth chapter of Hilchos Avodas Kochavim. This mitzvah is #24 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.