Rashi (several places in Shas) wonders how the Beis Hamikdash could be built on Shabbos (which Chazal say is a distinct possibility); isn’t that a desecration of Shabbos? Rashi answers that it is only regarding a Beis Hamikdash built by humans that there is a restriction of building it on Shabbos. The third Beis Hamikdash, however, will descend from Heaven miraculously, thus there are no restrictions regarding its building.
The Maharil Diskin is troubled by this answer, as the Jewish People have an obligation to build the Beis Hamikdash, so why would Hashem prevent us from performing this mitzvah?
He answers based on a Medrash in Eichah (2:9). It is written: "Tavu b'Aretz She-areha..." -- the gates of the Beis Hamikdash were hidden away, sunken into the ground, before the Beis Hamikdash itself was destroyed. When the Beis Hamikdash was destroyed, its gates sunk into the ground, and in the future, the Jewish People will excavate the gates and affix them to the Beis Hamikdash.
Our Gemora rules as follows: If a man builds a large mansion on the estate of a deceased convert (with no heirs) and another man comes and puts the doors on, the second person becomes owner. Why is this? It is because the first one merely arranged bricks there (for without the doors, there is no use for the mansion more that there already was with the land itself; it is the installation of the doors that completes the building).
Accordingly, we can say that we will fulfill the mitzvah of building the Beis Hamikdash when the Third Beis Hamikdash will descend from Heaven; it will be missing one thing. It will not have doors! The mitzvah will be fulfilled when we secure its gates.
This can also be the explanation of the words that we recite in the Shemoneh Esrei of Mussaf on the festivals: Show us its rebuilding (v’har-eynu b’vinyono) and gladden us with its perfection (v’samchenu b’tikuno). “Show us its rebuilding” refers to the sending down of the virtually completed third Beis Hamikdash. We will then complete the Beis Hamikdash by attaching the doors and will be gladdened by its perfection and by the fact that we fulfilled the mitzvah of building it.