Target detection at sub-pixel abundances is in fact one of the challenging issues of hyperspectral image processing. Selection of optimal bands to improve sub-pixel target detection (STD) performance is one of the common solutions, applied by many researchers. Nevertheless, absence of sufficient training data is the main weakness of selecting optimal bands with regards to this approach. The present research introduces a new band selection method for STD in hyperspectral images, based on creating training data, in which the desired target spectrum is implanted randomly in a series of host pixels from the entire hyperspectral image. Afterward, via running an optimization algorithm twice, with the aim of minimizing the false alarm rate (FAR) in local Adaptive Coherence Estimator (ACE) target detection algorithm, the number of optimal bands and optimal spectral bands are selected. In this study, the performance of three optimization methods, including Genetic Algorithm (GA), Grey Wolf Optimization (GWO), and Particle Swarm Optimization (PSO), are compared. Experimental results on Hymap and Hyperion datasets show that, the proposed method obtains the minimum FAR compared to the rest of evaluated methods. Also, based on the results obtained, GWO outperforms GA and PSO optimization methods in the STD domain.