The Holy Roman Empire was formed when Otto I was crowned Emperor in 962. The Empire was dissolved with the rise of Napoleon (Francis II being the last Emperor), in 1806.
So your question is, during that roughly 900 years why was not Hungary incorporated into the Holy Roman Empire?
We must separate these circa 900 years into two periods. The first one being 962-1718, and the second one 1718-1806.
Regarding the first period, to answer your question right away, the medieval Kingdom of Hungary was never incorporated into the Empire because it was never conquered by it. It tried multiple times, but without real success.
It is true there were was a short period during the second reign of King Peter Orseolo (1044-1046), who gained the throne with the help and become a vassal of the Emperor, but that ended quickly. Another ruler worth mentioning in this context was Sigismund of Luxemburg, who, during his exactly fifty years of reign as King of Hungary (1387-1437), also became Holy Roman Emperor, but only in his last years (1433-1437). And his sucessor to the Hungarian throne, Albert of House Habsburg only ruled for 2 years (1437-1439).
After him, a fully intact Kingdom of Hungary would not receive a ruler connected to the Holy Roman Empire (Habsburg or otherwise) for nearly 300 years.
From 1526 (with the battle of Mohács) the Kingdom of Hungary was divided into parts and was largely a battlefield between the Habsburgs and the Ottomans for the following two centuries, with none of them gaining the upper hand.
Finally around 1700, the Habsburgs became the rulers of the reunited Kingdom of Hungary (it happened in 1686 considering the retake of the capital, Buda; in 1699 considering most of the country; in 1718, considering the full kingdom). With this, we arrived to the end of the first period.
To reiterate: Hungary was not incorporated into the Holy Roman Empire because it was never conquered.
Now, regarding the second period (1718-1806), the question becomes: why did not the Habsburgs incorporate Hungary? I will not address this (complex) question, because of the following.
Even though the Holy Roman Empire was legally dissolved only in 1806, the Peace of Westphalia of 1648 left the power of the Holy Roman Emperor (and the concept of "the Empire" as well) a shadow of its former self.
So while in the 11th century, being incorporated into the so-called Holy Roman Empire was a valid concept (and a valid danger for the neighbouring states), after 1648, not anymore.
Your question was very short, but perhaps it was motivated by the example of Bohemia. That is, why were the contemporary Czechs incorporated into the Empire but the contemporary Hungarians were not?
I am not an expert on Czech history, so I am going to link /u/JudLew's comment from a similar AskHistorians thread.
(From my understanding, it came down to different 11th century histories of the respective countries.)
(If needed, I can cite (unfortunately only Hungarian) sources from the Hungarian National Electronic Library: [1] and [2])