First of all, in Trinitarian tradition, Jesus had no need for the Holy Spirit, because each is a person of the Holy Trinity. Luke 4 tells us that Jesus was easily able to overcome the temptations that Satan threw at him.
The earliest account of the temptation of Jesus is in Mark 1:12-13. Here, we are not told how Satan tempted Jesus, but the Spirit was apparently not present. Instead, angels ministered to Jesus during the forty days in the wilderness, resulting in an interesting mental image if we read the three temptations of Luke (and Matthew) back into this account:
Mark 1:12-13: And immediately the Spirit driveth him into the wilderness.
13 And he was there in the wilderness forty days, tempted of Satan; and was with the wild beasts; and the angels ministered unto him.
In Luke's more detailed account of the temptations (and in the parallel account in Matthew) it appears Jesus was entirely alone while Satan tempted him. It is hard to imagine the angels or the Holy Spirit permitting Satan to demand that Jesus worship him, or allowing Satan to take Jesus to the pinnacle of the temple. Although we are not actually told this, it has to be assumed that the Holy Spirit must have left Jesus, at least while he was in the wilderness.
Now we can look at the account even more critically in order to understand its true meaning. Dale C. Allison Jr. ('How to Marginalize the Traditional Criteria of Authenticity', published in Handbook for the Study of the Historical Jesus, Volume 1, edited by Tom Holmén and Stanley E. Porter - page 14) asks us to look at this account as an unhistorical fiction intended to help readers to understand the historical Jesus. He says:
Most modern scholars have rightly judged this to be unhistorical, an haggadic fiction produced through reflection on scripture. Yet whoever composed it clearly did so in the knowledge that Jesus was (a) a miracle worker who (b) sometimes refused to give signs, (c) thought himself victorious over demonic forces, (d) was steeped in the scriptures, (e) had great faith in God, and (f) was a person of the Spirit. So what we seem to have in Q 4:1-13 is an illustration of the obvious fact that historical fiction can inform us about history. The story, which narrates events that probably never happened, nonetheless catches Jesus in several respects. Here the inauthentic incorporates the authentic.
If most modern scholars have judged this to be unhistorical, then we need not try to understand whether the Holy Spirit had left Jesus, or why. Allison says that the story narrates events that probably never happened, but nonetheless catches the authentic Jesus.