Abstract. We are interested in the rate function of the moderate deviation principle for the twosample matching problem. This is related to the determination of 1-Lipschitz functions with maximal variance. We give an exact solution for random variables which have normal law, or are uniformly distributed on the Euclidean ball.Mathematics Subject Classification. 60D05, 60F10, 26D10.