We report on the demonstration of a switchable and adjustable spacing multiwavelength nanosecond pulsed ytterbium-doped fiber laser (YDFL) operating in a modelocking regime by macrobending loss tuning induced in a figure-eight knot shape. The figure-eight knot-based Mach-Zehnder interferometer (MZI) was established by wrapping a section of single-mode fiber into two elliptical loops by twisting one end of the fiber onto the other without splicing. Combining the proposed MZI with a polarization controller (PC) acts as a selective comb filter and a nanosecond pulse generator. By appropriately adjusting the bending diameter of the MZI structure inside the YDFL cavity, the laser can be operated in a single-and dual-wavelength with a maximum spacing range of 18.5 nm. Furthermore, the number of lasing wavelengths was directly controlled by only altering the pump power; dual and triple wavelengths were achieved as the pump power was increased from 127 to 210 mW, respectively. The appropriate adjustment of the PC cascaded with the proposed comb filter in the laser cavity allows for the generation of up to quadruple switchable wavelengths of nanosecond mode-locking pulses with a pulse duration of 6.2 ns and repetition rate of 71.4 MHz located between 1061.17 and 1038.92 nm. The experimental results indicate that the proposed configuration of the MZI-based comb filter can provide great potential in various photonics applications.