Microorganisms have a direct impact on human health, and the analysis of relevant data is helpful for disease diagnosis. However, the collected data suffers from two problems: class imbalance and high sparseness. Existing oversampling methods can alleviate the class imbalance of data to a certain extent, but it is difficult to cope with the high sparsity of microbial data. This paper proposes a data augmentation algorithm that fuses matrix factorization and cost-sensitive, which consists of three techniques. First, the original matrix is decomposed into a sample subspace and a feature subspace. Second, the positive vectors of the sample subspace and their neighbor vectors are used to generate synthetic vectors. Finally, the synthetic vectors are filtered according to their distance from all negative vectors. The proposed algorithm is compared with five oversampling algorithms on 8 microbial datasets. The results show that the proposed algorithm can enhance the diversity of positive samples and identify more positive samples with lower classification cost.