Wireless technology and the latest developments in a mobile object, has led to a Mobile Ad Hoc network (MANET), which is a collection of mobile nodes that are communicating with each other without requiring any fixed infrastructure. Due to the dynamic nature with a decentralized system, these networks are susceptible to different attacks such as Black Hole Attack (BHA), Gray Hole Attack (GHA), Sink Hole Attack (SHA) and many more. Several researchers have worked for the detection and mitigation of individual attacks, either GHA or BHA nodes. But the protection of MANET against a dual threat is scarce. In this project, the protection against dual attacks has been presented for BHA and GHA by using the concept of Artificial Neural Network (ANN) as a deep learning algorithm along with the swarm based Artificial Bee Colony (ABC) optimization technique. The performance of the system has been increased by the selection of appropriate and best nodes for data packets transmission which is explained in the result section of this project. For the network designing and simulation purposes, MATLAB software is used with communication and neural network toolboxes. The examined results show that the presented protocol performs better in contrast to the existing work under black hole as well as gray hole attack condition a mobile ad hoc network (MANET) is a collection of mobile nodes that dynamically form a temporary network without using any existing network infrastructure.