Autograph hound Al Babson (Eddie Cantor) accidentally disrupts the filming of a movie about Ali Baba, and is injured in the process. The filmmakers try to buy him off, but nurse Dinah (Virginia Field) suggests he be hired as an extra. He takes an overdose of painkillers, and his Arabian Nights dreams combine with the plot of the movie.
His name leads the populace to think he's the son of Ali Baba, and he's taken to the palace of Sultan Abdullah (Roland Young), who's so impressed by Al that he makes him prime minister.
Princess Miriam (June Lang) is in love with Yusuf (Tony Martin), the leader of the peasants, while Al has fallen for Deenah (also Virginia Field), whose father Omar (Maurice Cass) is trying to make a carpet fly. Meanwhile, the evil Prince Musah (Douglas Dumbrille) is conspiring with Sultana (Louise Hovick), one of Abdullah's many wives, to capture the princess, take over Bagdad, and kill Abdullah and Al as well.
Miriam and Yusuf are unhappy because royalty and commoners cannot marry, so Al comes up with a plan to help his friends, but the plan spectacularly backfires, and Abdullah orders him to be boiled in oil.