The 21-year-old goalkeeper is moving back to his native Czech Republic, after joining United from the second-tier side in 2018.
Ondrej represented our Under-18s on 18 occasions in 2019/20, including five appearances in the FA Youth Cup as Neil Ryan's youngsters made it to the semi-finals of the competition.
He was promoted to the Under-21s set-up the following campaign and made his bow in senior football during a penalty-shootout victory over Rochdale in the EFL Trophy in September 2020.
Mastny emulated compatriots Matej Kovar and Radek Vitek by representing the Reds in the UEFA Youth League, and he has been capped by Czech Republic at various youth levels.