Breastfeeding is the best form of feeding for premature infants. However, mothers with premature delivery are frequently reported to be depressed, and this has been especially the case during the Coronavirus Disease-2019 (COVID-19) pandemic. We aimed to measure the level of breastfeeding attitude and its association with postpartum depression among mothers with premature infants in the Neonatal Intensive Care Unit (NICU) during the COVID-19 pandemic. A total of 248 mothers with a premature infant were observed in this cross-sectional study from the chosen NICUs of government hospitals in Selangor, Malaysia. The Iowa Infant Feeding Attitude Score (IIFAS) and the Edinburgh Postnatal Depression Scale, along with sociodemographic questionnaires, were used to obtain information on the mothers' attitudes towards breastfeeding and the risk of postpartum depression. A higher percentage of mothers had a positive attitude towards breastfeeding (64.9%), with a mean IIFAS score of 66.30 ± 6.92. Meanwhile, about 27% of mothers with premature infants were reported to have high risk of depressive symptoms. Mothers with a high risk of depression were less likely to have a positive attitude towards breastfeeding (OR 0.37, 95% CI 0.199, 0.675) as compared to mothers with a low risk of depression (p < 0.01). We found that there is an association between the risk of depression and the attitude towards breastfeeding. Early identification of maternal mental health problems should be addressed to ensure the willingness of mothers to continue breastfeeding.