Mobile edge computing (MEC) becomes popular as it offers cloud services and functionalities to the edge devices, to enhance the quality of service (QoS) of end-users by offloading their computationally intensive tasks. At the same time, the rise in the number of internet of things (IoT) objectives poses considerable cybersecurity issues owing to the latest rise in the existence of attacks. Presently, the development of deep learning and hardware technologies offers a way to detect the present traffic condition, data offloading, and cyber-attacks in edge networks. The utilization of DL models finds helpful in several domains in which the MEC provides the decisive beneficiary of the approach for traffic prediction and attack detection since a large quantity of data generated by IoT devices enables deep models to learn better than shallow approaches. In this view, this paper presents a new DL based traffic prediction with a data offloading mechanism with cyber-attack detection (DLTPDO-CD) technique. The proposed model involves three major processes traffic prediction, data offloading, and attack detection. Initially, bidirectional long short term memory (BiLSTM) based traffic prediction to enable the proficient data offloading process. Then, the adaptive sampling cross entropy (ASCE) technique is executed to maximize the network throughput by making decisions related to offloading users to the WiFi system. Finally, a deep belief network (DBN) optimized by a barnacles mating optimizer (BMO) algorithm called BMO-DBN is applied as a detection tool for cyberattacks in MEC. Extensive simulation is carried out to ensure the proficient performance of the DLTPDO-CD model. The experimental outcome stated the superiority of the presented model over the compared methods under different dimensions. © 2019 IEEE Computer Society. All rights reserved.