Inspections play a crucial role in determining the state of a system and informing timely maintenance decisions. However, due to the limitations of adopted inspection technologies, inspection errors are often inevitable. More importantly, the likelihood of such errors is often influenced by the system's working environment that varies over time and space. Despite this, most studies on imperfect inspections largely overlook the effects of such dynamic working environments on inspection errors. To address this gap, this paper proposes a maintenance policy accounting for imperfect inspections for a degrading system with hidden failures under a dynamic working environment. We develop two models based on a recursive method. The first model examines a case where the working environment affects only inspection errors, whereas the second one accounts for its impact on both inspection errors and the system's degradation process. Our focus is to determine the optimal interval and number of inspections that minimize the expected maintenance cost over a finite time horizon. Numerical examples are provided to illustrate the proposed method to ensure the effectiveness of maintenance actions. The optimization outcomes not only offer a valuable tool for engineers seeking to reduce maintenance costs but also shed light on broader managerial implications.