I am a PhD candidate (last year) and was invited as a guest editor in a peer reviewed journal. I am excited to take the experience and I am sure I will handle it well, but I am not sure if I have to be a PhD holder to qualify for such position.
I think that until you have many years of refereeing papers behind you, you are not ready to be a guest editor.
By the way, I get invited to be a guest editor about once a week. Unless you have strong evidence to the contrary, you should assume this is spam and delete it. One way to check if a journal is reputable is to ask your advisor.
It'd be unusual to invite a PhD candidate to guest edit a journal. You are right to be suspicious. I would check if the journal is disreputable; simply being peer-reviewed is not sufficient. Even if the journal is reputable, I would still discuss with supervisor (not only about how to edit, but whether or not to do it, since it'll take time away from your PhD) before accepting the offer.
There are no general rules, inscribed on ancient scrolls, about such things, though an individual journal might have its own preferences or rules.
But, the person(s) who invited you is(are) almost certain to know of your status. So, assume it is fine.
Also, spend some effort to determine the reputation of the journal and the one who invited you. Your advisor can probably help with this.
It will take time and effort to do this, of course, so make sure you (and your advisor) are prepared for that.
The main question is whether you know the field well enough to identify reliable peer reviewers who will able to review the papers properly. You will also need to be able to judge from the reviewers comments whether the papers should be accepted and what needs to be done to improve them. It will be difficult to do both of these things without experience. Are you confident that you can do both of these things? If not experience, what is the basis for that belief?
Note that in some fields, e.g. climate, there are a lot of "fringe" scientists that repeatedly try and get obviously wrong arguments published in peer reviewed journals. In such cases the editor really needs to be aware of these "fringe" views and make sure that they receive a desk reject, or are reviewed by reviewers who are already familiar with the argument. Unfortunately "fringe" scientists often pick journals in other fields, where the topic could just about be considered within their remit, as they are unlikely to run into a reviewer that has seen the canard before. Here is an example of a very obviously wrong climate paper that got published in a peer reviewed journal on medical physics. Note the links to the comments papers towards the bottom of the page. You would have to be confident that this could not happen in an issue for which you were the editor, as the failure of the review process is ultimately the editor's responsibility.
This means you should definitely refuse unless the scope of the journal is very narrow.
P.S. "fringe" is used here euphemistically because in responding to "fringe" views it is important not to attach insulting labels in order to make sure we respond rationally and factually.