The classification of whole slide images plays an important role in understanding and diagnosing cancer. Pathologists typically have to work through numerous pathology images that can be in the order of hundreds or thousands which takes time and is prone to manual error. Here we investigate an automated method based on a random depthwise convolutional neural network (RDCNN). In previous work this network has shown to achieve high accuracies for image similarity. We conjecture that for histopathology images similarity may play an important role in accurate classification of the images. We evaluate RDCNN against trained deep convolutional neural networks VGG16 and ResNet50 on four pathology image datasets. We find RDCNN to give the average highest accuracy across the four datasets. On two datasets RDCNN is significantly higher in accuracy and comparable in the others. We examine top similar images to a randomly selected one in the ISIC and Gleason datasets and see that it indeed most of the similar images belong to the same category as the query in the RDCNN feature space compared to ResNet50 and VGG16. For such histopathology datasets where similarity also implies same class membership we can expect RDCNN to be highly accurate and useful.