According to J.E. Lighter, Random House Historical Dictionary of American Slang (1994) use of "boy!~" as an interjection meaning roughly the same thing as "wow!" or "gee!" or "man!" goes back only to 1894 (citing George Ade, Chicago Stories from that year).
The earliest matches in Google Books for the word pair "boy howdy" do not involve that kind of interjection, however. Instead, they use the words as a greeting. From Frances Baylor, Behind the Blue Ridge: A Homely Narrative (1887):
"That's Willy. Tildy's cousin. Bob's son. He's livin' with us now."
"Well, Willy boy, howdy," said John Shore, and the child limped down to him and they shook hands, John Shore full of kind interest and Willy all eyes.
From a subhead in the "Publishers Department: Items of Interest" section of the [Detroit, Michigan] Bulletin of Pharmacy (May 1894):
Shakespeare, Old Boy, Howdy!
And from Charles Stevenson, "Howdy," in Lippincott's Monthly Magazine: A Popular Journal of General Literature, Science, and Politics (April 1902):
"Kind o' like to hear 'em say it!— / 'Howdy, howdy!' / Know who's who right there an' then, / That's the moral truth, now, men,— / Put my trust right in him when / Man sez 'Howdy!'"
"Yes, sir, sounds like ol' times comin',— / 'Howdy, howdy!' / Hez the heft, an makes you feel / Like yore rely in the deal, / An yore friend kin sort o' 'spiel',— / Sayin' 'Howdy!'
"Folks all say in Mizzouree!— / 'Wal, wal, howdy!' / Hearty, honest, homely, gruff, / Gentle, kindly, yard-wide stuff, / Man that sez it's good enuff,— / 'Ol' boy, howdy!'
"Yes, sir, like to hear 'em say it! / 'Howdy, howdy!' / Hez a cheery, earnest ring, / No put-on, the A-I thing, / Gives yore own good-will a swing, / 'N you say, 'Howdy!'"
During World War I, "boy howdy" seems to have become a commonplace greeting among soldiers in the U.S. expeditionary force in Europe. From Burris Jenkins, Facing the Hindenburg Line: Personal Observations at the Fronts and in the Camps of the British, French, Americans, and Italians, During the Campaigns of 1917 (1917):
To give still more the atmosphere of Dixie, there is a big negro cook in a certain company. Down at the French port, where the boys landed, he saw another gentleman of color strolling about, and immediately breezed up to him as to a brother and opened up, "Boy, howdy!" The second negro replied in French.
...
This big cook has a voice like a bass violin and called out to every lad a half block away, "Boy, howdy," as nearly as I can make out and spell the vernacular greeting current in the American army.
And from "War Advertising," in the Tacoma [Washington] Times (June 1, 1918):
"Six of our [advertising] posters which are repeated around camp a good deal are:
"'Boy howdy, is your bayonet sharp?'
"Boy howdy" as an exclamation of surprise or enthusiasm appears in print by 1918. From "Americans Drive On Impetuously," in the [Philadelphia, Pennsylvania] Evening Public Ledger (July 19, 1918):
"We were just rushed into the trenches last night," said one youngster. "We were only there half an hour when the captain said, 'Boys in just twenty minutes we go over the top. There is time for every man to have a good smoke.'
"Before we reached their trenches the Heinies were running. Boy howdy! It sure gave me a glorious feeling to see the Heinies hop out like rabbits. We couldn't help laughing at 'em."
From "Canteen Notes," in the [Chicago Illinois] Advance Club News (September 15, 1918):
This man [a sergeant]'s departure seems to be the signal for more excitement, for before we could possibly have him out of sight of the canteen a boy from Camp Funston bound for Boston in the service of his Uncle Sam wants a place to lay his head and on being questioned it is learned that his funds have run out, probably a result of reckless financing, and that he has had nothing to eat since breakfast. We force him to eat and after a bath he feels better and does eat. "Boy Howdy" how he eats. You perhaps recall a time when you thought you were hungry, but this man proved he needed food by the way he put it out of sight.
From "Morale Is Maintained by 'Smokes'," a letter dated May 12, 1918, by Captain Alexander Withers of the U.S. Army, in McClure's Magazine (September 1918):
A few words to tell you how much the men appreciate the tobacco sent to them, and how much the officers appreciate their receiving it.
I heard men in the trenches bringing up supplies to-night. Suddenly the sentry in front of my dugout cried out in an excited manner, 'Boy howdy! Here it comes!' The Sergeant stepped outside of the door and returned, looking sheepish. 'It's tobacco, sir, and the men were out of it.'
From a submission from Toledo, Ohio, in "Correspondence of Local Unions," in the [Chicago, Illinois] American Photo-Engraver (December 1918):
We had our November meeting a week late on account of the [influenza] ban, and it was held on "Peace" night. Refreshments and everything. Boy howdy.
And from a letter from Captain Charles Harmon of the American Air Service in Roycroft (December 1918):
The Entente Cordiale is nowhere more cordial than between American Sammies and French Mademoiselles. One Sergeant doped it out for me thus: "We American guys and these French dames is the real grub-getters in our own countries. Us Americans have been so soft wid our women that they all the time want some more swell attention that don't jibe wid our income. And these here he-Frenchies have been petted to death. Natcherly us fellers and them girls hit it off together. Wy, this here little French gal of mine can take a couplerthree francs and go out and buy mor' 'n she can tote. And cook—Boy Howdy! Me, I gonna take home a wife that amounts to sumpin, believe me!"
The key stages in the emergence of "boy howdy" as an expression of enthusiasm thus seem to have been (1) affectionately greeting a person with words "[Name], old boy, howdy" (from the late 1800s); (2) using "boy, howdy!" as a two-word form of greeting to a person whether known to the speaker or not (popularized among U.S. troops during World War I, by 1917); and (3) extending the exclamatory use of "boy howdy!" to indicate excitement or enthusiastic approval (also popularized among U.S. troops during World War I, by 1918).
Although the earliest instance I found of "boy howdy" as a two-word greeting involves a Black military cook (attached to soldiers from the U.S. South)—and although a slightly earlier instance of such usage (from 1916), cited in the Dictionary of Regional English and mentioned in a now-deleted answer posted by user 66974, involves its use by a Black man at an army camp in Eagle Pass, Texas, there is too little evidence to assert with any confidence that "boy howdy" as a standalone greeting originated in African American speech.
Use of "boy howdy" as an excited exclamation seems not to have crossed over from U.S. troops to British troops in World War I. At any rate, Eric Partridge (who had a strong interest in British military slang of the twentieth century) never mentions it.