Green’s Dictionary of Slang

melon-farmer n.

1. (US) an unsophisticated person; a peasant.

[US]‘Hy Lit’ Hy Lit’s Unbelievable Dict. of Hip Words 27: melon farmer – A square; a seed.
[US]Current Sl. III–IV (Cumulation Issue) 76: Jive melon farmer, n. A Negro who is really a poor, hard-working laborer but who pretends to be hip [...] one who pretends to be ‘with it’ but really is not.

2. a euph. for motherfucker n. often used as the ‘equivalent’ when dubbing [coined by Alex Cox, director of Repo Man (1984) when re-dubbing the film for television].

Repo Man [film] Flip you, melon farmer!
[UK]Roger’s Profanisaurus 3 in Viz 98 Oct. 19: melon-farmer exclm. The BBC authorised, poorly dubbed version of ‘Motherfucker’ used in films such as ‘Die Hard’ and the entire ‘Beverly Hills Cop’ series. Also ever-loving.