The vehicular network plays a significant role in understanding the detailed study of vehicle communications. Multiple vehicles in the local communication range need to exchange the safety and infotainment information via common roadside infrastructure in Vehicular Ad hoc Networks (VANETs). The vehicle-to-Infrastructure (V2I) communication model helps to improve the efficiency of the intelligent transport system by providing safety warnings and reducing vehicle collisions. Machine learning is an artificial intelligence component that allows the machine to learn without being expressly trained to improve from experience automatically. Since VANET is imprecise and uncertain, Machine Learning (ML) and Software Agents (SAs) combining approaches resolve the issues of V2I communication challenges in VANETs. This paper proposes ML-based V2I Communication in VANETs using a software agent approach. The proposed agent-based model is made up of both static and mobile agents. The proposed model executes the decision tree algorithm to identify the event as non-critical or critical. The Q-Learning algorithm identifies the destination vehicle with improved bandwidth utilization, packet delivery ratio, end-to-end delay, V2I communication delay, and throughput and control overheads.