Egghead is a happy looking wanderer who is traveling near an Arabian-like place, where he is lured to a prize machine. He sees a golden lamp but can't get it because another man wants it and is already using the machine. The man however lucks out and gets candy beans. He runs to the back corner in order to weep his sorrow away.
Egghead sneaks up and tries his luck at getting the gold-lamp, and succeeds. He says, "Oh boy am I lucky". It is then revealed that the only he reason he got the lamp was because he mistake it for a sugar bowl. He looks at the back of the lamp and it reads, "Rub Lamp 3 times". Egghead does so and a genie appears, which scares Egghead and he runs off; only for the genie to pull him right back.
The genie then explains to him that he isn't, "Going to hurt him". He also explains to Egghead that he is now the master of the lamp, and that if he ever needed anything all he needed to do was rub the lamp. Egghead asks for some, "Nice new clothes", and the genie responds by changing what he is wearing. This makes Egghead smile, and he thanks the genie.
Hiding behind the corner is the same guy who previously screwed up his chance to get the lamp. He claims that the lamp belongs to him and that he will get it.
Meanwhile Egghead sees a sign advertising that a man will be giving away his daughter hand in marriage by setting up a contest. Egghead then wishes for a magic carpet and one appears. He takes off to the, "Royal Palace" and hopes to win the princesses hand in marriage, but finds that there is long line before him.
The princess cries as two guards send in a tough-looking but dumb man named Ali-Baabe Breen, who repeats, "Mary had a little lamb". This doesn't impress the sultan and he opens a hatch and sends Ali falling into it.
As several contenders enter including, "Slap Happy Boys" Egghead emerges with the title, "Aladdin and his wonderful lamp". His lamp has been stolen and has been replaced. The minute the princess sees him, she falls madly in love. Egghead tries to please the king with a dance and a song about how the princess is the fairest in all of the land, but it only annoys him. Egghead tries to please the sultan with his magic lamp, but his stupidty gets the better of him, and he doesn't realize that he doesn't have it any more. He claims that the lamp is crazy and is thrown out of the palace.
He watches from the window. Inside the man who stole his lamp is trying to impress the king and thanks to his lamp is doing an incredible job. The Sultan declares a wedding and the horn is played, but Egghead arrives shouting, "I've been swindled" and knocks the man right out. He grabs the princess and takes off with her. At the end she decides to go with the Genie because he looks more attractive.