As a common skin disease, malignant melanoma has attracted great attention in dermatology with high morbidity and mortality. Traditional medical diagnoses rely on clinical experience and have a certain subjective bias. Aiming at the problem of similarity between classes of melanoma dermoscopic images and the imbalance of lesion data set, we propose a CFLDnet-based dermoscopic image lesion classification model, it mainly uses the improved convolutional block attention (CBA) DenseNet algorithm to enhance beneficial features. To better integrate the attention module into DenseNet without increasing too many parameters and wasting the computing resources, we discussed three types of variant networks derived from the CFLDnet. Moreover, to balance the different categories of the data set, we also use the Sample Focal Loss (SFL) to calculate the effective sample size of the data set and smooth the focal loss function. Large numbers of comparative experiments were done based on the ISIC2018 task3 dataset, the average recognition accuracy of the CFLDnet network proposed in this paper is 86.89%, which is much higher than other similar methods (VGG16, ResNet50, InceptionV3 and DenseNet121 with cross-entropy loss function).