I must have been 14 when I saw this film, and have never seen it since - but I still remember it, old B&W low budget thing that it was.
As I remember it, Peter Barkworth plays Stephen, a relative bystander who is asked to invade the psyche of Peter Parnell, a scientist who has come up with a fantastically useful (something), but has retreated catatonically into the suicidal fantasy world residing in his brain.
Science has found a way to allow Stephen to enter this fantasy world, and work with and reason with Peter and try to lure him out of this introversion, which if not interrupted will eventually spiral down to his death. Stephen is warned: the danger is real, he too can die in there.
Stephen is warned that his own efforts will be constantly subverted by Peter's fantasy where he plays the hero, but with a dark side that is likely to lead them into trouble. He will have his own resources, but will need courage to draw on them.
This leads to many hilarious scenes, such as: (I quote after more than 30 years) Peter: We must try to reach the sorceres'es castle, but it is a thousand miles through the burning sands.
Stephen: A thousand miles? Blow that! Taxi!
Taxi: Where you want to go, mate?
Stephen: Sorceres'es castle please!
Taxi: Pfwouagh! Thousand miles, mate! Big fare, you got the money?
Stephen: Sure!
Taxi: OK mate, hop in.
Apart from the numerous high quality laughs, the basic psychology is sound: an intelligent but self-destructive scientist is rescued in the end by a young man who agrees to the task, but is only able to do it in the end by calling on the bottom of the barrel: the security built into his psyche when he was a child, by an understanding father.
An interesting sidelight is: although rescued, the scientist does not like his rescuer on awakening - nor do the other incidentals who were also asleep at the same time, and were drawn into the fantasy/dream, such as the taxi driver who was merely asleep at the local ramp, but was required to drive to the castle ... and told to "go to hell" when the fare was due - which he did.