The Internet of Things (IoT) plays a vital role in many application domains like battlefield surveillance, wildlife monitoring, disaster response, medical care, transportation, industry, smart home, smart cities, etc. However, this network is susceptible to various types of attacks due to its special features like sensing, intelligence, large scale, self-configuring, connectivity, heterogeneity, open and dynamic environment. It is significant to ensure security in the IoT network. In the scalable and dynamic IoT environment, conventional security mechanisms such as cryptography techniques, key management, intrusion detection system, anomaly detection, etc cannot be applicable, because it consumes more energy. Therefore, the IoT network requires a lightweight security mechanism for reliable and secure data transmission. A trust-based security solution solves many security-related problems. The proposed RFTrust model provides a trust-based lightweight solution for ensuring security in the IoT network. It is primarily designed to address the sinkhole attack in Routing Protocol for Low power and Lossy networks (RPL) based IoT environments. It enhances the trusted routing in the IoT environment by finding and removing sinkhole nodes in the network. The proposed model uses Random Forest (RF) and Subjective Logic (SL) to improve the network performance by identifying sinkhole attack. The mathematical analysis shows the applicability of the proposed model. The merits of the proposed work are highlighted by comparing performance with the existing similar protocols in terms of delivery ratio, throughput, average delay, energy consumption, false-positive rate, false-negative rate, and detection accuracy.