The film opens on the assassination of the president of the fictional “banana republic” of San Marcos and a coup d’├ętat that brings Gen. Emilio Molina Vargas (Carlos Montalban) to power.

Fielding Mellish (Woody Allen) is a neurotic blue collar man who tries to impress social activist Nancy (Louise Lasser) by trying to get in touch with the revolution in San Marcos. He visits the republic and attempts to show his concern for the native people. However, Vargas secretly orders his men, disguised as Vargas’s opponents, to kill Mellish, to make the rebels look bad so that the U.S. will send Vargas financial aid. Mellish evades Vargas’s assassins, but is shortly after captured by the real rebels. Vargas declares Mellish dead regardless, leaving Mellish no choice but to join the rebels for two months. Mellish then learns, clumsily, how to be a revolutionary. When the revolution is successful, Esposito, the Castro-style leader, goes mad. The rebels decide to replace him with Mellish as their president.

When traveling back to the U.S. to obtain financial aid, Mellish (sporting a long fake beard) reunites with Nancy and is exposed. In a classic courtroom scene, Mellish tries to defend himself from a series of incriminating witnesses, including a reigning Miss America and a middle-aged African-American woman claiming to be J. Edgar Hoover in disguise. One of the witnesses does provide testimony favorable to Mellish, but the court clerk, when asked to read back this testimony, replies with an entirely different, wholly unfavorable rendition. Mellish is eventually sentenced to prison, but his sentence is suspended on the condition that he does not move into the judge’s neighborhood. Nancy then agrees to marry him. The film ends with the between-the-covers consummation of their marriage, an event that was over much more quickly than Nancy had anticipated.