The line was related to me in 1970 in South Vietnam, by a fellow soldier. He told me it was a story retold to him by a WW2 POW veteran. The Japanese camp commandant had lined up all the Aussies and was berating them in his best Japinglish.
He was told by the POW that the commandant came out with, "You Ostalians think Japanese stupid. You think Japanese know f**k-nothing! We soon show you, that Japanese know f**k-all!!"
Of course, the Australian POW's apparently broke out in fits of laughter, which only made the little Jap officer go apoplectic, and scream more abuse at them, and told guards to hand out beatings.
So the basic line goes back a long way, but I wouldn't imagine much more before WW2, as the F-word wasn't used a great deal back then, and it was regarded as a particularly vile word in the 1920's and 1930's.
This article on the origins of the F-word is quite interesting. The word has been in use for centuries, but almost never in publications, as it was deemed obscene when in print.
https://bigthink.com/the-past/history-of-the-f-word/