The growing ubiquity of Internet of Things (IoT) devices within smart homes demands the use of advanced strategies in IoT implementation, with an emphasis on energy efficiency and security. The incorporation of Artificial Intelligence (AI) within the IoT framework improves the overall efficiency of the network. An inefficient mechanism of parent selection at the network layer of IoT causes energy drain in the nodes, particularly near the sink node. As a result, nodes die earlier, causing network holes that further increase the control message overhead as well as the energy consumption of the network, compromising network security. This research introduces an AI‐based approach to parent selection of the Routing Protocol for Low Power and Lossy networks (RPL) at the network layer of IoT to enhance security and energy efficiency. A novel objective function, named Energy and Parent Load Objective Function (EA‐EPL), is also proposed that considers the composite metrics, including energy and parent load. Extensive experiments are conducted to assess EA‐EPL against OF0 and MRHOF algorithms. Experimental results show that EA‐EPL outperformed these algorithms in improving energy efficiency, network stability, and packet delivery ratio. The results also demonstrate a significant enhancement in the overall efficiency of IoT networks and increased security in smart home environments.