Temporary hit points in Dungeons & Dragons are a mechanic that allows "a buffer against damage" (PHB 198). There are a few spells of note that can affect a character based on how many hit points they currently have, most notably sleep, power word stun, and power word kill.
Does temporary HP count towards the HP total for determining resistance for these effects?
Best Answer
No; temporary HP is not actual HP.
The rules distinguish temporary hit points as separate and distinct from actual hit points (emphasis mine):
As you can see, the rules clearly specify that temporary hit points aren't actual hit points. Thus, spells that affect characters based on their HP, such as sleep ("Creatures [...] are affected in ascending order of their current hit points"), power word stun ("If the target has 150 hit points or fewer, it is stunned."), and power word kill ("If the creature you choose has 100 hit points or fewer, it dies.") don't consider temp HP at all in determining whether the creature is affect.
Rules designer Jeremy Crawford unofficially confirms this answer in a 2017 tweet:
So no, temporary HP is not considered for the effects of those spells unless explicitly stated otherwise in the spell description. It's generally just a damage buffer, nothing more.