Simulating lattice gauge theory (LGT) Hamiltonian and its nontrivial states by programmable quantum devices has attracted numerous attention in recent years. Rydberg atom arrays constitute one of the most rapidly developing arenas for quantum simulation and quantum computing. The Z2 LGT and topological order has been realized in experiments while the U(1) LGT is being worked hard on the way. States of LGT have local constraint and are fragmented into several winding sectors with topological protection. It is therefore difficult to prepare a state in certain sector for experiments, and it is also an important task for quantum topological memory. Here, we propose a protocol of sweeping quantum annealing (SQA) for searching the state within target topological sector. With the Monte Carlo method, we show that this SQA has linear time complexity of size with applications to the antiferromagnetic transverse field Ising model, which has emergent U(1) gauge fields. This SQA protocol can be realized easily on quantum simulation platforms such as Rydberg atoms and superconducting circuits. We expect this approach would provide a generic recipe for resolving the topological hindrances in quantum optimization and the preparation of quantum topological state.