Ethan Stables, 20, was handed the order at Leeds Crown Court nearly four months after he was found guilty of plotting to attack the LGBT event in Cumbria last June.
He was described as “a risk to the public” by Recorder Peter Collier QC.
“The prosecution say that you made up a pack of lies as you tried to manipulate your way out of this situation,” he said.
“It’s my clear decision that, for the protection of the public, a hospital order and restriction order are necessary, and that is made.”
Mr Collier said that although Stables, from Barrow, Cumbria, had not carried out the attack, he caused “alarm and distress” by planning it.
He was convicted in February of preparing an act of terrorism, making threats to kill and possessing explosives.
Stables was arrested by armed police on 23 June 2018 as he walked towards the New Empire pub in Barrow, after receiving a tip-off.
He had posted a message on a far-right Facebook group saying he was “going to war” and he planned to “slaughter every single one of the gay b*******”.
When he was arrested he was unarmed but when police searched his home they found an axe and a machete.
Officers discovered he had searched the internet for how to make a bomb and found a collection of cut-off match heads in his flat.
He had also googled “how to make chemical poison”, “what is prison like for a murderer”, and “do you get haircuts in prison”.
Jurors were shown a video of Stables burning a rainbow flag and posing next to a swastika hanging on his bedroom wall.
His mother said he became radicalised after a trip to Germany to see a young woman. Stables claimed he was “brainwashed” by right-wing extremists he met while living in hostels.
Described as a loner by his own barrister, Stables, who has an autism spectrum condition, swapped messages with fellow extremists and blamed the fact that he was jobless on “f****ts, n******, spastics” and the Equalities Act.
At other times, he expressed his hatred of Muslims and Jews, and claimed in a WhatsApp message: “My country is being raped.
“I might just become a skinhead and kill people.”
Jurors were told Stables was interested in the Columbine High School massacre, and had been expelled from school following an incident in which he put another pupil in a headlock.
More from UK
Teenage boy stabbed to death in Wolverhampton
Pair face jail after claiming £125,000 by posing as Grenfell victims
UK ‘deeply concerned’ over Russian pursuit of British Kremlin critic Bill Browder
Tony the Tiger and Honey Monster could be banned
Helicopter crashes into field in North Yorkshire
Missing teenager Serena Alexander-Benson is with her mother in Poland
Stables claimed he was a just fantasist and was himself bisexual.
He denied he was carrying out a “recce” of the venue when he was arrested and said he was heading out to sit outside the job centre to use the free public wifi.