The increasing global population, along with concerns about fossil fuel depletion and environmental pollution, has necessitated the development of alternative modes of transportation. The strategic allocation of charging stations for electric vehicles is essential for maximizing their benefits. A significant portion of power system losses can be attributed to the distribution network, primarily due to its low voltage levels, high currents, and the high ohmic resistance of the conductors. Therefore, addressing the reduction of losses in the distribution network is crucial. Various methods and algorithms have been proposed to minimize losses in distribution networks. One of the earliest and most effective approaches for reducing system losses is the allocation of capacitors within the distribution network. However, the use of capacitors in these networks has slightly declined due to the growth of distributed generation (DG) and the diversity of their output power. Currently, the allocation of distributed generation resources has supplanted this method. Over the past half-century, reconfiguring distribution systems has proven to be one of the most straightforward and cost-effective approaches for reducing distribution losses. Numerous studies have focused on the reconfiguration of distribution systems, each with distinct objectives. Additionally, many of these studies have examined distribution system reconfiguration on both a daily and hourly basis. This paper aims to reduce losses and improve the voltage profile by proposing a bi-level optimization problem. We present a novel method for dynamic distribution network reconfiguration by dividing 24 h into many intervals, rather than relying solely on real-time and hourly data (lower level). Electric vehicle charging stations (EVCSs), shunt capacitors (SCs), and distributed generation sources are optimally allocated (upper level). It is possible to reduce losses and improve voltage profiles by reconfiguring and allocating EVCSs, SCs, and DGs during these periods. Simulations were conducted on an IEEE 33-bus network. MATLAB software was utilized to reduce losses and improve the voltage profile using a genetic algorithm. According to the simulation results, this model produces better outcomes than previous approaches.