Yes, it is possible to study your last year in middle school in Mexico and then go back to start high school in the USA.
However, you will need to apply for a Mexico Student Visa if you intend to study in Mexico for longer than 180 days. You will also need to present school records proving that you have completed the previous year of school and have qualified to continue to the next grade level.