I see Starfleet Academy as a post-18 (or equivalent for other cultures!) institution, but crucially something you enroll in as a young adult if you want to be a career Starfleet officer.
I imagine that it provides academic tuition as well as training to become an officer. A lot of characters on the various shows have mentioned very academic-sounding theoretical courses taught at the academy, for example, Temporal Mechanics, Archaeology, Exobiology, Creative Writing (!) (Google for "Walter Horne", mentioned in "The Game").
I'm sure a lot of these courses have a slant towards how they might be used in the field, but certainly the Academy seems to be providing academic tuition as well as battle drills and simulator training.
A stay at the Academy seems to last three or four years for our main characters, but remember of course that they all tend to be quite exceptional students serving on flagships at the like, so it may be that for your more average Starfleet Academy graduates, a stay might be a bit longer.
In any case, I'm sure there's time to get all this done, obviously I'd expect teaching methods to be better in the 24thC, what with the vast amount of data they have on human and alien psychology.
Those who don't go down the Starfleet route could surely go to a traditional university (and I suspect that continuous learning to better oneself is emphasized in a society where people can get by without working a day in their lives), I'm sure Starfleet Academy welcomes graduates who join later in life bringing their unique skills to Science or Medical or Engineering -- perhaps their course could be shorter, or they could skip the bits they already studied elsewhere, or specialize in something else whilst they're there.
Schools in general in the Federationverse seem to be a bit less structured than education in the Western world today (presumably children learn at home where no school is available, and we often see children of vastly different ages being taught in the same school room), I'd imagine there's less pressure to learn X, Y and Z by a particular age, and people are considered on a more case-by-case basis.