SummaryThe Internet of Things (IoT) has provided us with various applications that need processing in real‐time. Fog computing has arisen as a highly effective computing paradigm that provides services closer to the IoT devices and hence fulfills the need for rapid response time and delay requirements of IoT applications. However, the heterogeneity of IoT tasks and the limited resources of fog nodes pose considerable challenges to task scheduling. Therefore, the effective utilization of fog resources is highly significant and necessitates an optimal and intelligent approach to task scheduling. This paper presents the “deadline‐cost aware task scheduling” (DCaTS) algorithm, which is designed for fog‐based IoT applications. The primary objective of this algorithm is to minimize the monetary cost while taking into account the deadline requirements and priority of tasks. The efficacy of DCaTS is assessed by analyzing various parameters, including completion time, monetary cost, response time, and waiting time. The experimental results show that in comparison with traditional policies, the proposed algorithm shows superiority in all the parameters. The proposed algorithm reduces the monetary cost up to 11.07% compared with the second best result. The results also indicate that DCaTS achieves a reduction of 10.05% in completion time, 10% in response time, and 10.12% in waiting time compared with the second best result.