The artificial Immune Recognition System (AIRS) algorithm inspired by a natural immune system makes use of the training data to generate memory cells (or prototypes). These memory cells are used in the test phase to classify unseen data using the K-nearest neighbor (K-NN) algorithm. The performance of the AIRS algorithm, similar to other distance-based classifiers, is highly dependent on the distance function used to classify a test instance. In this paper, we present a new version of the AIRS algorithm named Adaptive Distance AIRS (AD-AIRS) that uses an adaptive distance metric to improve the generalization accuracy of the basic AIRS algorithm. The adaptive distance metric is based on assigning weights to the evolved memory cells. The weights of memory cells are used in the test phase to classify test instances. Apart from this, the AD-AIRS algorithm uses the concept of clustering to modify the way that memory cells are generated. Each memory cell represents a group of similar instances (or antigens). A subset of the UCI datasets is used to evaluate the effectiveness of the proposed AD-AIRS algorithm in comparison with the basic AIRS. Experimental results show that the AD-AIRS achieves higher accuracy with a fewer number of memory cells when compared with the basic AIRS algorithm.