"piece of cloth used to mend another material," late 14c., of obscure origin, perhaps a variant of pece, pieche, from Old North French pieche (see piece (n.)), or from an unrecorded Old English word (but Old English had claðflyhte "a patch"). Phrase not a patch on "nowhere near as good as" is from 1860.
"fool, clown," 1540s, perhaps from Italian pazzo "fool," of unknown origin. Possibly from Old High German barzjan "to rave" [Klein]. But Buck says pazzo is originally euphemistic, and from Latin patiens "suffering," in medical use, "the patient." Form perhaps influenced by folk etymology derivation from patch (n.1), on notion of a fool's patched garb.
mid-15c., from patch (n.1). Electronics sense of "to connect temporarily" is attested from 1923. Related: Patched; patching.