Boppard and St. Goar are separated by about 10 train minutes. Both centrally are well located for outings, generally speaking. If you are only visiting towns along the Rhine, and don't mind paying for your day passes and the hours restrictions they carry with them, St. Goar is a convenient and desirable base town for visits on both sides of the river, slightly better than Boppard for access to points south, slightly worse than Boppard for points north. There's no huge time advantage for one town over the other.
But things change if you plan on doing outings up the pretty Mosel River via Koblenz. Cochem, Trier and other Mosel towns you might choose to visit will require a disproportionate amount of actual travel time - from St. Goar, it's roughly 1:40 to Cochem vs. 1:00 from Boppard. The same occurs on the return trip... getting back from Cochem to St. Goar takes 1:37 vs. 0:57 to Boppard. So St. Goar > Cochem > St. Goar takes 3:17 round trip, while Boppard > Cochem > Boppard takes 1:57.
Why the huge time advantage from Boppard? 1.) St. Goar is served only by RB milk-run trains, while Boppard is served by RE regional express. 2.) Layover times in Koblenz for the RB trains is significant - about 35 minutes, vs. about 10 minutes for the RE trains.
Marksburg Castle, in the old-world town of Braubach, is the best medieval castle experience on the Rhine IMHO and is reachable from either town by train - you'll save maybe 20-25 minutes round trip by train from Boppard.
Cochem is a fine place to visit for several reasons. With 3-4 days, I would think you might enjoy a visit there, possibly with a cruise to Beilstein.
https://www.tripadvisor.com/Attractions-g198637-Activities-Cochem_Rhineland_Palatinate.html
As for the towns themselves, St. Goar is very scenic and very quiet, maybe slightly geriatric by comparison with Boppard, which has a much greater number of restaurant and lodging choices and at times even a slight buzz to it. There's a good bit more going on in Boppard than in St. Goar at a given point in time. Beer: you can get this everywhere, of course. Wine and wineries: this is what the Rhine is all about, and Boppard has no shortage of wineries:
https://www.deutschlandgourmet.info/bilder/gross/5710-Restaurant-Weinhaus-Heilig-Grab-Boppard.jpg
https://www.boppard-tourismus.de/media/weingut_2020.pdf