Do you have to write one yourself, or are you looking for an example that is already written? Or, are you referring to the poem that Hamlet writes to Ophelia, which Polonius reads? I am guessing it is NOT the latter, because that poem is a love poem (sort of) and does not refer to any insanity.
There is a funny poem about Hamlet that is a parody of Green Eggs and Ham, by Dr. Suess, called Green Eggs and Hamlet:
Green Eggs and Hamle
Green Eggs and Hamlet
I ask to be or not to be.
That is the question I ask of me.
This sullied life, it makes me shudder.
My uncle's boffing dear sweet mother.
Would I, could I take me life?
Could I, should I end this strife?
Should I jump out of a plane?
Or throw myself before a train?
Should I from a cliff just leap?
Could I put myself to sleep?
Shoot myself or take some poison?
Maybe try self-immolation?
To shudder off this mortal coil,
I could stab myself with a fencing foil.
Slash my wrists while in the bath?
Would it end my angst and wrath?
To sleep, to dream, now there's the rub.
I could drop a toaster in my tub.
Would all be glad if I were dead?
Could I perhaps kill them instead?
This line of thought takes consideration -
For I'm the king of procrastination.
This poem is available at the link below, for authorship information. It shows Hamlet's depression - do you think he was really insane, or profoundly depressed, angry, etc.?
There is also a sonnet about Ophelia that shows her depression. It also refers to her mental instability:
He holds me no longer in his weary heart,
His words are concave, his mind wanders
To the time he awaits; when he depart
This iniquitous place and no one ponders.
My heart now collapses in its wintry fears
And with my profound knowledge, I shall die
And leave this murky place of sorrow and tears
With no melancholy, shallow words, no goodbye.
My saccharine love for him has broken me
And sent my spinning mind into the abyss;
I shatter, drowning in the icy shadowy sea
And be left naught but a spectre, to reminisce.
Hamlet, I leave thee with my innermost regret,
And entreat that I will not be a girl to forget.
This poem is found at the second website below.
If this is not what you are looking for and you need to write your own poem, please re-post your question so we can help you.