Answer by Alex Sumner:
It is possible to program the contents of your dream in advance, by fixing a firm intention in your mind immediately before falling asleep. This is akin to a form of self-hypnosis.
It is also possible to do it “in-dream.” Contrary to what other responders have answered, this is not simply a case of just lucid dreaming, but of becoming lucid and using self-hypnosis again but this time to convince yourself that you have the power to alter your dreams on the fly. It takes practice but it can be done.
I write more about it here: https://solascendans.com/articles