Tuberculosis is the leading cause of death due to a single infection prior to the COVID-19 pandemic. Screening of tuberculosis patients in a large population is of paramount importance for disease treatment and control, especially with an economical, accurate, and easy-to-operate method. Based on cough sounds, we proposed DMRNet to distinguish between patients with tuberculosis, other respiratory diseases, and healthy individuals. DMRNet comprises four convolutional blocks and six identification blocks and incorporates dynamic convolution into the first three convolutional blocks to promote feature extraction. After the second and third dynamic convolutions, a polarized self-attention mechanism was added to reduce the information loss caused by the dimensionality reduction. Finally, a multihead self-attention layer is added to the fourth convolutional block and the last three identification blocks to enhance the aggregation of global information. Using a dataset with 1323 cough sound fragments, the results achieved the accuracy, sensitivity, and specificity of tuberculosis screening were 94.32%, 97.73%, and 99.43%, respectively. Compared with reported studies, the proposed model demonstrated better accuracy and reliability. Cough sound-based DMRNet analysis is a promising method for tuberculosis screening, especially in densely populated areas. Owing to its convenience, low equipment requirements, and low cost, it is expected to become an effective tool for community tuberculosis screening.INDEX TERMS Convolutional neural networks, cough sounds, tuberculosis screening.