As an instructor, I offer undergraduates the opportunity to earn extra credit throughout the semester. However, that opportunity is dried up two weeks before the end of the term.
Why? Because I am a grading machine at that point in time and I don’t have the time or desire to take a student who has goofed off all semester and add to my own burden when things are winding down.
When is it good to seek extra credit? From the very start of the course, not two days before final grades are due. If I see a student who has worked hard all term, has done every bit of extra credit all semester, I am more likely (but not guaranteed) to look kindly on that individual at final grades time.
When can you get extra credit in graduate school? Never. End of sentence.