Agriculture has played a significant role in the lifespan of human beings for their survival and the better economic growth of the country. Due to its intensified growth, smart agriculture has been a popular domain recently. This aggregates the benefits of any computing technologies, like wireless sensor networks (WSN), drones, Internet of Things (IoT), remote sensing, etc. The IoT system places sensors on agricultural areas to accumulate critical information for the crops and fields to increase the overall rate of productivity. While broadcasting the sensed information in the domains to the target, there is a chance of the existence of cyber-threats, which intruders design to attain access to the content being transferred. Intrusion detection in IoT-based smart farming using deep learning (DL) leverages the power of deep neural networks (DNN) to safeguard agricultural systems from cyber threats. DL algorithms can autonomously detect unauthorized and anomalies activities by analyzing data streams from sensors, IoT devices, and farm management systems. With this motivation, this study designs an Enhanced Black Widow Optimization with Hybrid Deep Learning Enabled Intrusion Detection (EBWO-HDLID) technique in the IoT-based Smart Farming environment. The proposed EBWO-HDLID technique captures complex patterns and detects significant intrusions, assuring the security and reliability of smart farming. In the presented EBWO-HDLID approach, the bald eagle search (BES) algorithm can be used for the feature selection process. For the intrusion detection and classification process, the EBWO-HDLID technique applies the HDL classification model. Finally, the EBWO algorithm can be used for the parameter tuning of the HDL technique. The experimental validation process demonstrates the satisfactory performance of the EBWO-HDLID model on two benchmark datasets: ToN-IoT, and Edge-IIoTset datasets.