In order to address high latency issues that may arise when executing timecritical applications at the cloud side, the novel fog computing paradigm has emerged, thus enabling the execution of such applications within computation nodes present at the edge of the network. While executing such applications, a user may be moving in an area where a high number of heterogeneous fog nodes (FNs) co-exist. This makes the problem of selecting the most appropriate fog node to execute the user’s tasks challenging, especially since the set of visible FNs dynamically changes. Therefore, to deal with the uncertain and dynamic nature of such a fog computing environment, we model the FN selection problem using multi-armed bandits. However, standard solutions for the bandit problem are not tailored for scenarios with changing FN availabilities. In addition, since switching from one FN to the other causes a switching cost, such solutions lead to accumulating a high switching cost. Therefore, to address these issues, we first propose a block-based FN selection scheme, where switching among FNs is not allowed during a block of timeslots. We also propose a greedy approach, where FNs having a sufficiently good delay performance are selected in a greedy manner. Simulation results reveal that both approaches significantly improve the FN selection performance. In particular, we found that the blockbased selection results in the lowest switching costs, whereas the greedy selection achieves the best overall performance.Peer ReviewedPostprint (author's final draft