We establish orthogonality relations for the Baker–Akhiezer (BA) eigenfunctions of the Macdonald difference operators. We also obtain a version of Cherednik–Macdonald–Mehta integral for these functions. As a corollary, we give a simple derivation of the norm identity and Cherednik–Macdonald–Mehta integral for Macdonald polynomials. In the appendix written by the first author, we prove a summation formula for BA functions. We also introduce more general twisted BA functions and obtain for them identities of Cherednik type. This leads to an implicit construction of new quantum integrable models of Macdonald– Ruijsenaars type. Our approach does not require Hecke algebras and therefore is applicable to deformed root systems. As an example, we consider the deformed root system R = An(m), which leads us to an explicit evaluation of a new integral and a sum of Cherednik–Macdonald– Mehta type.