Foal nursing behavior is a crucial indicator of healthy growth. The mare being in a standing posture and the foal being in a suckling posture are important markers for foal suckling behavior. To enable the recognition of a mare's standing posture and its foal's suckling posture in stalls, this paper proposes an RT-DETR-Foalnursing model based on RT-DETR. The model employs SACGNet as the backbone to enhance the efficiency of image feature extraction. Furthermore, by incorporating a multiscale multihead attention module and a channel attention module into the Adaptive Instance Feature Integration (AIFI), the model strengthens feature utilization and integration capabilities, thereby improving recognition accuracy. Experimental results demonstrate that the improved RT-DETR achieves a best mAP@50 of 98.5%, increasing by 1.8% compared to the RT-DETR. Additionally, this study achieves real-time statistical analysis of the duration of the foal in the suckling posture, which is one of the important indicators for determining whether the foal is suckling. This has significant implications for the healthy growth of foals.