Of the 12 major keys, F♯/G♭ is the only one that can be reasonably notated in two ways (for example, C♭ and C♯ are far more awkward than B and D♭). Both F♯ and G♭ are in common use, but G♭ is rather more common. Why? If the music sticks to the diatonic major scale (as this piece largely does), then both keys are equally complicated, but major-key music often introduces secondary dominants such as V/ii and V/vi (seen in mm. 10 and 16 of this piece respectively) that are written with naturals in G♭ but would require double sharps in F♯. It is slightly more unusual to see the brief modal mixture that shows up in the score as double flats. So the key choice is a toss-up, and Dvorak chose the slightly more familiar G♭.
As for the resultant mismatch with the middle section, pianists are used to seeing enharmonic key changes when moving to the parallel minor (e.g. the D♭ maj-C♯ min shift in Chopin's 3rd Scherzo, Fantaisie-Impromptu and the "Raindrop" Prelude).