BackgroundSchool attendance is a crucial determinant of academic success. Our previous research has identified factors that influence elementary school students’ perceptions of attending school, but whether these factors apply to older students remains unclear. We investigated the extent to which the factors identified in the previous research apply to junior high school students and their attitudes toward attending school.MethodsWe hypothesized that students’ “perceptions of attending school” was directly influenced by their perceptions of “relationships with friends and teachers,” “current circumstances,” “subjective health status,” and “having people to share experiences and thoughts with.” We developed an original questionnaire with 19 items and analyzed data collected from 6245 junior high school students in Japan, using a structural equation model.ResultsThe final model demonstrated a good fit. Students’ “positive perceptions of attending school” was directly and positively influenced by their “positive perceptions of relationships with friends and teachers” and directly and negatively influenced by their “perceptions of poorer subjective health status”. Other latent variables directly and positively influenced the perceptions of attending school, but not strongly. Students’ perceptions of “relationships with friends and teachers,” “current circumstances,” and “having people to share experiences and thoughts with” correlated positively with each other. These three latent variables also correlated negatively with “poorer subjective health status.”ConclusionsThe role of positive relationships with friends and teachers in shaping students' perceptions of school attendance, coupled with the negative impact of poorer subjective health status, underscores the need for educators to adopt approaches that specifically address these areas. It is crucial to provide support to students in cultivating positive relationships, fostering positive perceptions of school, and offering resources to those who are encountering mental or physical health challenges. Implementing the evidence-based questionnaire developed in this study is recommended to enhance student support and well-being.Supplementary InformationThe online version contains supplementary material available at 10.1186/s13034-023-00631-w.