This paper considers a distance metric learning (DML) algorithm for a fingerprinting system, which identifies a query content by finding the fingerprint in the database (DB) that measures the shortest distance to the query fingerprint. For a given training set consisting of original and distorted fingerprints, a distance metric equivalent to the norm of the difference of two linearly projected fingerprints is learned by minimizing the false-positive rate (probability of perceptually dissimilar content to be identified as being similar) for a given false-negative rate (probability of perceptually similar content to be identified as being dissimilar). The learned metric can perform better than the often used distance and improve the robustness against a set of unexpected distortions. In the experiments, the distance metric learned by the proposed algorithm performed better than those metrics learned by well-known DML algorithms for classification.