Virtualized fog–cloud computing (VFCC) has emerged as an optimal platform for processing the increasing number of emerging Internet of Things (IoT) applications. VFCC resources are provisioned to IoT applications in the form of virtual machines (VMs). Effectively utilizing VMs for diverse IoT tasks with varying requirements poses a significant challenge due to their heterogeneity in processing power, communication delay, and energy consumption. In addressing this challenge, in this article, we propose a system model for scheduling IoT tasks in VFCCs, considering not only individual task deadlines but also the system's overall energy consumption. Subsequently, we employ a greedy randomized adaptive search procedure (GRASP) to determine the optimal assignment of IoT tasks among VMs. GRASP, a metaheuristic‐based technique, offers appealing characteristics, including simplicity, ease of implementation, a limited number of tuning parameters, and the potential for parallel implementation. Our comprehensive experiments evaluate the effectiveness of the proposed method, comparing its performance with the most advanced algorithms. The results demonstrate that the proposed approach outperforms the existing methods in terms of deadline satisfaction ratio, average response time, energy consumption, and makespan.