How to detect the context of homepage for a wordpress mu sub-blog

You could test using the following conditionals

//if you aren't on the main site, and aren't on the homepage
if (!is_main_site() && (!is_front_page() && !is_home())) {
  print "<a href="https://wordpress.stackexchange.com/questions/238529/sub-blog-homepage">home</a>";
}
//if you aren't on the main site, and aren on the homepage
if (!is_main_site() && (is_front_page() && is_home())) {
  print "<a href="main-site-homepage">home</a>";
}

Also depending on how your sub-blog homepage is configured, you could use either is_front_page(), is_home().