In the power grid, communication networks play an important role in exchanging smart grid-based information. In contrast to wired communication, wireless communication offers many benefits in terms of easy setup connections and low-cost high-speed links. Conversely, wireless communications are commonly more vulnerable to security threats than wired ones. All power equipment devices and appliances in the smart distribution grid (SDG) are communicated through wireless networks only. Most security research focuses on keeping the SDG network from different types of attacks. The denial-of-service (DoS) attack is consuming more energy in the network leads to a permanent breakdown of memory. This work proposes a new metaheuristic optimization inspired by maternal care of hen to their children called hen maternal care (HMCO) inspired optimization. The HMCO algorithm mimics the care shown by hen for their children in nature. The mother hen is always watchful and protects its chicks against predators. All chickens utilize different calls to designate flying predators like falcons and owls from ground seekers like foxes and coyotes, showing that they can both survey a danger and advise different chickens how to set themselves up. Our method shows greater performance among other standard algorithms.