Features play an important role in various visual tasks, especially in visual place recognition applied to perceptually changing environments. We address challenges in place recognition due to dynamic and confusable patterns by proposing a discriminative and semantic feature selection network named DSFeat in this study. With supervision of both semantic information and attention mechanism, the pixel-wise stability of features can be estimated, which indicates the probability of a static and discriminative region where features are extracted. We can then select features that are insensitive to dynamic interference and distinguishable for correct matching. The designed feature selection model is evaluated in place recognition and SLAM system using several public datasets with varying appearances and viewpoints. Experimental results demonstrate the effectiveness of the proposed method. Note that our proposed method can be easily integrated into any feature-based SLAM system.