I could not find evidence of an existing test and there is no widely accepting known cause. The only risk factor commonly noted is having been previously affected by AMS. Other mentioned risk factors include:
- anemia
- preexisting heart or lung disease
However I found one article about a study done by a subgroup of the European Society of Cardiology (ESC). in 2013 where they studied a group of 34 volunteers at sea level and at 3842m after passive ascent. They measured O2 saturation and a parameter they denote TAPSE (systolic function of the right ventricle evaluated by cardiac ultrasound) and observed whether symptoms of AMS occur after 24h. Combining the results of both O2 and TAPSE after 4h at high altitude, they predicted 92% of the AMS cases and 94% of the non-affected cases. Both measurements are non-invasive and cheap, so they remaining problem is that you have to pass 4h at high altitude.
They mention ongoing research and a quick search revealed quite a few recent papers on the topic, but I did not yet have time to look at them.