Deep learning (DL) models have achieved remarkable success in various domains. But training an accurate DL model requires large amounts of data, which can be challenging to obtain in medical settings due to privacy concerns. Recently, federated learning (FL) has emerged as a promising solution that shares local models instead of raw data. However, FL in medical settings faces challenges of client drift due to the data heterogeneity across dispersed institutions. Although there exist studies to address this challenge, they mainly focus on the classification tasks that learn global representation of an entire image. Few have been studied on the dense prediction tasks, such as object detection. In this study, we propose dense contrastive-based federated learning (DCFL) tailored for dense prediction tasks in FL settings. DCFL introduces dense contrastive learning to FL, which aligns the local optimization objectives towards the global objective by maximizing the agreement of representations between the global and local models. Moreover, to improve the performance of dense target prediction at each level, DCFL applies multi-scale contrastive representation by utilizing multi-scale representations with dense features in contrastive learning. We evaluated DCFL on a set of realistic datasets for pulmonary nodule detection. DCFL demonstrates an overall performance improvement compared with the other federated learning methods in heterogeneous settings-improving the mean average precision by 4.13% and testing recall by 6.07% in highly heterogeneous settings.