In the dynamic landscape of Industry 4.0, characterized by the integration of smart technologies and the industrial internet of things (IIoT), ensuring robust security measures is imperative. This paper explores advanced security solutions tailored for the IIoT, focusing on the integration of intrusion detection systems (IDS) with advanced machine learning (ML) and deep learning (DL) techniques. In this paper, we present a novel intrusion detection model to fortify to fortify Industry 4.0 systems against evolving cyber threats by leveraging ML an DL algorithms for dynamic adaptation. To evaluate the performances and effectiveness of our proposed model, we use the improved Coburg intrusion detection data sets (CIDDS) and BoT-IoT datasets, showcasing notable performance attributes with an exceptional 99.99% accuracy, high recall, and precision scores. The model demonstrates computational efficiency, with rapid learning and detection phases. This research contributes to advancing next-gen security solutions for Industry 4.0, offering a promising approach to tackle contemporary cyber.