Classification using cross-datasets (where a classifier trained using annotated image set A is used to test similar images of set B due to lack of training images in B) is important for many classification problems especially in biomedical imaging. We propose a discriminative autoencoder, useful for addressing the challenge of classification using cross-datasets. Our autoencoder learns an encoder and decoder such that the distances between the representations of the same class is minimized whereas the distances between the representations of different classes are maximized. We derive a fast algorithm to solve the aforementioned problem using the Augmented Lagrangian Alternating Directions Method of Multipliers (ADMM) approach. ADMM is a faster alternative to back-propagation which is used in standard autoencoders. The proposed method outperforms state-of-the-art representation learning tools in terms of classification results in breast cancer related histopathological image set MITOS and AMIDA and some of the benchmark image datasets. © 2018 IEEE.