Deep metric learning (DML) has achieved state-of-the-art results in several deep learning applications. However, this type of deep learning models has not been tested on the classification of electrical brain waves (EEG) for brain computer interface (BCI) applications. For the first time, we propose a triplet network to classify motor imagery (MI) EEG signals. Stockwell Transform has been used for converting the EEG signals in the time domain into the frequency domain, which resulted in improved DML classification accuracy in comparison to DML with Short Term Fourier Transform (0.647 vs. 0.431). DML model was trained with a topogram of concatenated 64 EEG channel spectrograms. The training batch was comprised of triplet pairs of the anchor, positive, and negative labeled epochs. The triplet network was able to train an embedding feature space that minimized the Euclidean distance between the embeddings of spectrograms of the same class and increased the distance between the embeddings of different labeled images. The proposed method has been tested on an EEG dataset of 109 untrained subjects. We showed that the DML classifier is able to converge with an extremely small number of training samples (~ 120 EEG trials) for only one subject per model, mitigating the well-known issue of the large inter-individual variability of human MI-BCI EEG which degrades the classification performance. The proposed preprocessing pipeline and the Triplet Network provide a promising method to classify MI-BCI EEG signals with much less training samples than the previous methods.