Earth alliance wouldn't last long against the 40k ... at all
How powerful are these guys?
Short primer on the Warhammer 40K universe:
The Imperium of Man consists of hundreds of thousands of inhabited worlds and some of them are called Hive Worlds that contain up to a hundred billion people.
Their techlevel is kind of stuck on a moderate to high level since their golden age of technology and discovery but since then much was lost due to wars and superstition.
This means that most of their powerful tech is very old and needs constant maintenance and if some very complicated devices fail it may be impossible to repair them.
What this leads is to is space ships that are gigantic in comparison to Star Trek.. main battleships are kilometres long (their command ships are somewhere in the 15km range) and their light cruiser are bigger than anything Starfleet has ever produced but they are in constant danger of just falling apart.
The Imperium relies on brute power.. a single capital ship is capable of devastating an entire world but it is big, slow and for sure very outclassed by Starfleet vessels. However they are heavily armored and shielded and did i mention big so one needs to inflict quite some damage to really affect them.
Another thing to take into consideration are boarding actions.. if done by "normal" imperial Navy personell then they'd be not that different to Starfleet personell. Maybe leaning a bit more to the true military but they'd be a match for Starfleet (Starfleet officers rarely wear any kind of body armor).
However if the boarding action is performed by Space Marines then a Starfleet ship is in real trouble. Space Marines are the absolute elite of the Imperium. 2,5m tall, genetically enhanced superwarriors designed for the most extreme and dangerous missions and equipped with a fully enclosed combat armor and firing a mini-grenade/missile launcher as a standard assault rife means they'd rip anything apart they encounter on a Starfleet vessel (these types of actions are their specialty after all).
Personally i'd put my money on the 40K Imperium.. Starfleet vessels could run rings around them but they don't have the firepower to destroy a vessel that's 10+ kilometres long and that itself is loaded for bear with weapons of all kinds.
Sure the imperial technology sucks in comparison to Starfleet but a single direct hit by an imperial weapons battery or a lance battery (huge, honkin' superlaser) would instantly destroy even a Sovereign class.
If we are going the realism route then Starfleet torpedoes should have been vastly more powerful than depicted in the shows.. they contain warheads that are vastly more powerful than any nuclear bomb and should some of them detonate inside an imperial ship then even they stand no chance