Device-to-Device (D2D) communication plays a prominent role in mobile data offloading from the cellular infrastructure (e.g., base station). This paradigm empowers user equipment to communicate with each other directly, offering an efficient resort for data communication that eliminates the need for the base station. However, significant challenges, such as interference, resource allocation, and energy efficiency, impede the performance of D2D communication. In the context of resource allocation, most of the existing work primarily focuses on game and graph theoretical models, which raises the computational complexity as the number of D2D users increases. In this article, we formulated a sum rate maximization problem, which is solved using a combinatorial scheme comprised of Whale Optimization Algorithm (WOA) and Federated Learning (FL). First, we discover the optimal CUs-D2D Groups (D2DGs) pairs by utilizing the social behavior of whales in the WOA. Only these optimal links are permitted to participate in the FL-based resource allocation, ensuring a physical layer access control. Next, we generated a dataset from the WOA-based optimal CU-D2DG links, which is employed by the Convolutional Neural Network (CNN) model for decentralized learning. FL offers a proactive decision for resource assignment, i.e., whose CU resources will be used by the D2DG. The proposed scheme is evaluated by considering different performance parameters, such as convergence rate, statistical measure (accuracy, loss), fairness (0.72), and overall sum rate ().