Wireless sensor networks (WSN) has been extensively used in many real time wireless sensor networks applications. Due to limitations of hardware resources and restricted communication capabilities of sensor nodes, it is very challenging to use wireless sensor networks in real time data transmission. Data collection and routing is the main issue in such applications. To enhance the performance under such real time transmission scenario, it is essential to make the protocol intelligent to choose the appropriate path with change in network scenario. Now a days, many machine learning and deep learning algorithms are used for improving the real time data transmissions in WSNs. From the survey on existing methods, it is clear that using machine learning makes the computational methods more reliable, powerful and economical. This paper proposes a machine learning based Medium Access Control (MAC) protocol to handle real time traffic in wireless sensor networks. To deal with the limitations of WSN in real time application, the proposed scheme can help to increase the performance of time-critical wireless sensor network applications. Simulation results authorize our work and confirm the accuracy of the proposed ML-MAC protocol strategy is higher than the existing work.