Purpose: In yttrium-90 (90Y) microsphere brachytherapy (radioembolization) of unresectable liver cancer, posttherapy 90Y bremsstrahlung single photon emission computed tomography (SPECT) has been used to document the distribution of microspheres in the patient and to help predict potential side effects. The energy window used during projection acquisition can have a significant effect on image quality. Thus, using an optimal energy window is desirable. However, there has been great variability in the choice of energy window due to the continuous and broad energy distribution of 90Y bremsstrahlung photons. The area under the receiver operating characteristic curve (AUC) for the ideal observer (IO) is a widely used figure of merit (FOM) for optimizing the imaging system for detection tasks. The IO implicitly assumes a perfect model of the image formation process. However, for 90Y bremsstrahlung SPECT there can be substantial model-mismatch (i.e., difference between the actual image formation process and the model of it assumed in reconstruction), and the amount of the model-mismatch depends on the energy window. It is thus important to account for the degradation of the observer performance due to model-mismatch in the optimization of the energy window. The purpose of this paper is to optimize the energy window for 90Y bremsstrahlung SPECT for a detection task while taking into account the effects of the model-mismatch. Methods: An observer, termed the ideal observer with model-mismatch (IO-MM), has been proposed previously to account for the effects of the model-mismatch on IO performance. In this work, the AUC for the IO-MM was used as the FOM for the optimization. To provide a clinically realistic object model and imaging simulation, the authors used a background-known-statistically and signal-known-statistically task. The background was modeled as multiple compartments in the liver with activity parameters independently following a Gaussian distribution; the signal was modeled as a tumor with a Gaussian-distributed activity parameter located randomly with equal probability at one of three positions. The IO test statistics (i.e., likelihood ratios) were estimated using Markov-chain Monte Carlo methods. The authors realistically modeled human anatomy using a digital phantom code, and realistically simulated 90Y bremsstrahlung SPECT imaging with a clinical SPECT system and typical imaging parameters using a previously validated Monte Carlo bremsstrahlung simulation method. Model-mismatch was included by modeling image formation process in the calculation of IO test statistics using an analytic modeling method previously developed for quantitative 90Y bremsstrahlung SPECT. To demonstrate the effects of the model-mismatch on the detection task, the authors optimized the energy window both with and without model-mismatch included in the IO. Results: For all the energy windows, the AUC values for the IO-MM were smaller than that for the IO. The optimal windows for the IO-MM and the IO were 80-180 and 60-400 keV, respectively. Conclusions: The authors have demonstrated the degradation of the ideal performance due to model-mismatch and optimized the energy window for 90Y bremsstrahlung SPECT for detection tasks by accounting for the effects of the model-mismatch. The obtained optimal window was much narrower when taking into account the model-mismatch and similar to that obtained previously for estimation tasks.