Dengue disease has serious health and socioeconomic consequences. Preventive actions are needed to avoid outbreaks. Bayesian spatiotemporal models with conditional autoregressive (CAR) and random walk (RW) priors are two common smoothing approaches used in disease mapping to develop early warning systems and action plans. However, this approach can lead to over-smoothing, such that discontinuities in the risk surface are "averaged" out. Moreover, local variation in the relationship between disease risk and spatiotemporal risk factors can be concealed by the assumption of homogeneous regression effects. To overcome these problems, we propose a two-stage spatiotemporal clustering approach. In the first stage, an agglomerative hierarchical clustering algorithm is applied to map out the complete set of cluster configurations. In the second stage, the optimal cluster configuration is selected using a spatiotemporal model with spatiotemporally varying coefficients. The methodology is applied to data for 30 districts in the city of Bandung, Indonesia, for the period January 2012 to December 2016. Weather factors are used as the risk factors. High-risk and low-risk clusters are identified that strongly vary across space and time, with sunshine duration, precipitation, evaporation, and humidity as the most important risk factors.