It depends on whether you are approaching the question from a narrative perspective or an empirical perspective.
Narrative: The Federation wins because the Federation are The Good Guys™ and the Empire are The Bad Guys™. The Federation starts out on the back foot and it looks pretty grim in the middle, but ultimately they eke out a win. If this is a TNG two-parter it plays out the way "The Best of Both Worlds" did: engineering prowess combined with timely application of the human factor wins the day. If this is a DS9 arc or Discovery season, then Section 31 does what needs to be done.
Empirical: The Empire crushes the Federation like a bug. The Imperial industrial base is enormous and their power generation capabilities vastly surpass anything the 24th century Federation can muster:
- The Death Star could violently destroy an entire planet, reducing it to asteroids. In "The Die Is Cast," a combined Romulan-Cardassian fleet requires multiple volleys to simply glass the surface of a planet.
- The Millennium Falcon—a ship a little larger than a runabout—could cross the known galaxy (Tatooine on the rim, Alderaan in the core) in a day. Voyager estimated a similar journey would take 70 years at maximum cruising speed.
- In the 2360's the Federation built six Galaxy-class ships and maybe a few dozen more throughout the course of the Dominion war. These are among the largest, most powerful, most advanced ships the Federation can build, yet they are dwarfed by an Imperial II-class Star Destroyer and the Empire built hundreds of these in the mere two decades it existed.
It you could somehow snap these two spacefaring nations into existence and pit them against each other, it would be like late-WWII United States facing off against Napoleonic France. It's a blowout.