Flexible line rate is one of the key features for future optical access networks offering optimized throughput to multiple fiber-to-the-X users with different channel conditions and service priority; meanwhile, considerations should focus on technological transition from single-wavelength 50G higher-speed PON (G.hsp) based on optical direct detection systems to future digital coherent technology 100G/λ and beyond. In this paper, we propose a single-carrier modulation scheme that can achieve flexible line rates with arbitrary rational oversampling ratios without altering sampling rate of the transceiver. In the proposed scheme, the waveforms are based on the well-shaped Dirichlet kernel using discrete Fourier transforms (DFT). However, in comparison to conventional single-carrier frequency-division multiplexing (SC-FDM), the Dirichlet waveform of the proposed modulation algorithm is real-valued; in such a way, the proposed algorithm can be readily applied for both pulse amplitude modulation (PAM) for direct detection PON and, with forward compatibility to, future digital coherent PON with e.g., quadrature amplitude modulation (QAM). To validate the feasibility of the proposed system, experiments were carried out and flexible data rates from 62.1 to 174.5 Gbit/s with up to 8-ary PAM was successfully demonstrated for IM/DD-based PON using a fixed sampling rate at 64 GSa/s. The experiments show that the oversampling ratio can be arbitrary rational numbers no less than 1 to adjust the signal Baud rate. As a result, the proposed scheme is promising for offering optimal bandwidth allocation for current IM/DD-based and future coherent PON.