An efficient and dynamic role-based access-control (RBAC) model is presented in this work which utilizes access-control for internet of things (IoT) nodes while minimizing storage and computational overhead. Also, for the identification of the malicious packets at the gateway server, a machine learning method has been presented. In addition, a framework for data management techniques in the IoT environment is designed to ensure efficient and secure storage, management, and processing of IoT data. The results have been evaluated by using the Montage and Cybershake workload in terms of energy consumption, processing time, detection accuracy and misclassification rate. The results show that the proposed secure framework for effective workload resource management (SFE-WRM) attains better performance in comparison to the reliable and energy‐efficient route selection (REERS) and FTA-WRM method. Also, by using the security method, the proposed method provides better security to the IoT nodes during the data aggregation and processing of the workload. The ultimate aim of this work is to provide a solution for the development of a secure and efficient IoT environment that can address critical security challenges and enable the widespread adoption of IoT devices and services.