I have a relatively mid-to-top tier linux desktop (i5-13600K, 64 GB ram) and an M2 Macbook pro (M2 max, 32GB ram). The linux desktop comfortably outperforms the M2 in any CPU based benchmarks while also being significantly cheaper (though the M2 desktop machines are cheaper than the laptops, but still more expensive than the alternatives). If I were doing GPU heavy work than I assume the M2 would have a leg up, but then again I could just buy whatever GPU I wanted for the desktop machine and put it in there and I think it would outperform the mac once again.
However, if you were concerned about power consumption than the M2 would win by a mile, but for me it wasn't a huge factor in a desktop machine.
I saw 64GB vs 32GB here, many apps are memory intensive, thus the linux desktop will win no matter how faster M2 is, it will be interesting to run cpu intensive benchmark between them and see how that goes.
for ML training or 3D graphics, I wonder how M1 and M2's NPU and GPU are supported under Linux, unless they're optimized and verified to be superior, I will grab a machine with RTX 3090Ti instead.
I have a very CPU intensive single threaded program that runs about 15% faster on the intel CPU. Other CPU benchmarks out there show my particular processor is slightly ahead of the M2 (and there are faster intel/amd processors than the one in my machine). But if you look at power consumption I believe the intel CPU uses something like 3-5x the power to generate that slightly better performance.
At the high end of performance, the M2 is just light years better than any other chip (other than the M1) in terms of performance per watt. But if that stops being a concern to you then I think most linux desktop users are better off just getting a "normal" intel machine, which also will have 100% driver support for everything, cost less, and probably be faster.
However, if you were concerned about power consumption than the M2 would win by a mile, but for me it wasn't a huge factor in a desktop machine.