Dr Barry Morgan is leading a service of thanksgiving at St John the Baptist Church in Wales High School, Aberdare, on Wednesday.
More than 100 clergy are expected as well as past and present staff and students.
The school choir will sing an anthem composed by one of the pupils, "A Blessing", written by Year 10 pupil David Anthony.
Archbishop Morgan and the pupils will bury a time capsule in the school grounds after the special service and old photographs and medals will be on display, including those of former pupil, Rhys Jones, the Paralympic athlete.
The Archbishop paid tribute to the school: "I am delighted to join St John's as it celebrates its 40th birthday.
"It's a remarkable school which values and encourages all its pupils - teaching them not just how to pass exams - although it does that very well - but how to care for others, be compassionate and have faith.
"Over the years it has nurtured several generations of children in strong Christian values and become a key part of the community it serves."
Head teacher, Dr Susan Mitchell said, "This celebration is the climax of a very successful year for our school.
"Estyn school inspectors graded the school as 'Excellent' and the Welsh Government has categorised the school as a 'Green' and 'Category 1 school'.