Why don’t the replacements fit? What axle have you bought?
The most important part is getting the length and thread pitch correct. SRAM usually say a 174mm axle is for 142mm spacing and the 180mm axle is for 148mm boost but it actually depends on the thickness of the dropouts etc so it is still possible to have a 174mm axle in a boost frame.
I presume you’ve taken those specs off the actual axle as they’ll be etched on it usually?
174mm Sram Maxle Stealth Rear MTB, 12X142, 174mm, Length 20mm, Thread Pitch M12X1.75 Standard Frames Axle, Black, 12X142mm https://www.amazon.co.uk/dp/B06XB3MGWP/ref=cm_sw_r_cp_api_i_b4i2Eb0D4KNT1
180mm Sram Maxle Stealth Rear MTB, 12X148, 180mm, Length 20mm, Thread Pitch M12X1.75 Boost Frames Axle, Black, 12X148mm https://www.amazon.co.uk/dp/B06XBG5FDN/ref=cm_sw_r_cp_api_i_T6i2EbR6FA10M