Find the file default-widgets.php in wp-includes folder of WordPress Installation. Keep a backup of the original file incase you make mistake. Find the following lines of code under Recent_Posts widget class
Change it to these. We have added the rel=”nofollow” attribute for the link elements of related post links
Refresh the WordPress posts or pages where you have configured the default related posts widget. The links of the Widget have become nofollowed.