Aside from a complete examination of your investment options in each (which, most likely, will be superior in the IRA, but maybe not?) and a thorough analysis of your lifestyle and health risks (the HSA will be easier to access for health emergencies, obviously), it’s a really tough choice to make because they are both such great options. A good problem to have!
I have the same situation of being unable to max out all of my pre-tax investments but being able to contribute greater than my employer match to both an IRA (SIMPLE IRA, in my case) and an HSA. Here’s how I resolved it:
I made sure there was plenty in the HSA to start, contributing my $2,000 in just a few months. Then, I reduced my contributions to the minimum $5/month (I get no match for my HSA) and contributed instead to my other pre-tax investments. My tiny contributions from here on out are able to be invested. I also requested that my employer automatically deposit any bonuses I get to my HSA, because there is plenty of room to spare for them before I’d reach the family contribution limit.
My solution was not necessarily the most mathematically efficient choice. Forgoing investible IRA contributions in favor of non-investible $2k of HSA money is, well, giving up a lot of earnings. However, I am looking at the HSA as a substantial boost to my pre-existing emergency fund. If I run into a big medical emergency in my family, I’ll be happy to have that money there. I do not intend to draw from it until retirement, but the added security of knowing I can was worth the forgone earnings, to me.