A thermionic gun usually suffers from the long beam tail problem, and this is also the case in the compact terahertz free-electron laser facility in the Huazhong University of Science and Technology. Here we propose to use a radio frequency (RF) deflector operated in the dipole mode as a beam chopper to cut off the unnecessary beam tail. The RF deflector, followed by a scraper and a scintillation screen, will be installed in the drift space between the gun and the linac. The RF deflector system can be operated in two configurations: (1) a beam chopper, with the scraper pushed in, to prevent the tail particles from entering the linac; (2) a bunch length diagnostic instrument, with the scintillation screen pushed in, to measure the longitudinal profile from the electron gun. The systematic design of the RF deflector is presented, and the performance on beam chopping and bunch length measurement is investigated.