No, TG126 is from BKK (Suvarnabhumi), not DMK (Don Muang). All flights from Don Muang are 4-digit flight numbers, not 3. So you should be able to have your luggage checked through and do a CIQ transfer at BKK and then pass immigration/customs in Chiang Mai rather than in Bangkok. Be sure to specifiy that you will do such when you check-in at JFK, and you will then need to go to the transfer desk at BKK, and let them tell you where to go from there, rather than going through immigration at BKK
Had your flight been from Don Muang, then you couldn't have done that and would have had to collect your bags before exiting customs at BKK.